Controller, data storage device, and program product

ABSTRACT

According to one embodiment, a write instructing unit instructs a data access unit to write, in a storage area of a data storage unit indicated by a first physical address, write object data, instructs a management information access unit to update address conversion information, and instructs a first access unit to update the first physical address. A compaction unit extracts a physical address of compaction object data, instructs the data access unit to read the compaction object data stored in a storage area of the data storage unit indicated by the physical address, instructs the data access unit to write the compaction object data in a storage area of the data storage unit indicated by a second physical address, instructs the management information access unit to update the address conversion information, and instructs a second access unit to update the second physical address.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of U.S. application Ser. No.15/530,151 filed Dec. 8, 2016, which is a continuation of U.S.application Ser. No. 13/933,804 filed Jul. 2, 2013, which is acontinuation of U.S. patent application Ser. No. 12/883,796 filed Sep.16, 2010, which is based upon and claims the benefit of priority fromJapanese Patent Application No. 2010-063191 filed Mar. 18, 2010; theentire contents of each of which are incorporated herein by reference.

FIELD

Embodiments described herein relate generally to a controller, a datastorage device, and a program.

BACKGROUND

In the related art, in data storage devices, such as a hard disk drive(HDD) or a solid state drive (SSD), use states of storage media aremanaged using a variety of management information, such as a conversiontable where a logical address (LBA: Logical Block Address) and aphysical address (PBA: Physical Block Address) are associated with eachother. The logical address is a logical address of a storage medium thatcan be recognized by a host device, such as a server computer, acontroller of a storage system or a personal computer. The physicaladdress is an address that indicates a physical storage position of thestorage medium.

As an example of the storage medium of the data storage device, asemiconductor storage element, such as a NAND-type flash memory, isknown. This storage medium disables a random read/write operation ofdata, and needs to read/write data in a unit called a page, constructs astorage area of a unit called a block where plural pages are collected.In order to write new data in data written pages or blocks, written dataneeds to be erased in a block unit. That is, data can be sequentiallywritten in a page unit with respect to pages of data erased blocks wheredata is not yet written, and overwrite of data is disabled with respectto data written pages.

A unit of read/write when the host device performs a data read/writeoperation with respect to the data storage device is called a sector andis determined independently from a page unit or a block unit. Forexample, a block size is determined as 512 kilobytes, a page size isdetermined as 4 kilobytes, and a sector size is determined as 512 bytes.

In the data storage device using the storage medium having theabove-mentioned constraints, a block managing method that uses a size ofthe integral multiple of a block size as a management size of data inmanagement information is adopted. When random write is requested fromthe host device in the block managing method, the data storage devicereads data, which is not updated by the write request and is included indata stored in one or more blocks corresponding to a logical addressarea that is a range of logical addresses where write is requested bythe host device, in a temporary storage area. The data storage devicemerges the data with write object data. The data storage device executesa process of erasing one or more new write object blocks, writes themerged data, and updates the management information such that thelogical address area and one or more new write object blocks correspondto each other.

As described above, in the block managing method, since a data writtensize and a data read size in the data storage device is significantlylarger than a data write requested size requested from the host device,a process time may increase and random write performance may besignificantly deteriorated.

For this reason, in the data storage device using the storage mediumhaving the above-mentioned constraints, the random write performance isimproved using a log-structured method (for example, refer to MendelRosenblum and John K. Ousterhout, “The LFS Storage Manager”, Proceedingsof the 1990 Summer Usenix, Anaheim, Calif., June 1990, pp. 315-324),which is executed by an operating system (OS) memory management or afile system.

In the data storage device using the log-structured method, write objectdata is sequentially written in ascending order of pages, regardless ofa logical address designated by the write request from the host device.If a write request that designates a previously designated logicaladdress again is made from the host device, the data storage devicewrites new write object data in a non-written page of a block where anerasing process is completed. The data storage device invalidates thepage (page where data is written when the corresponding logical addressis designated in the past) corresponding to the logical address in themanagement information, validates a page where new write object data iswritten, and associates the page with the corresponding logical address.

In the data storage device using the log-structured method, if thenumber of invalidated pages increases, the number of new blocks wheredata can be written and an erasing process is completed (i.e., thenumber of free blocks where data is not written after the erasingprocess) decreases and new data write may not be performed. For thisreason, compaction (corresponding to garbage collection) is performed atappropriate timing.

In performing the compaction, the data storage device collects validdata stored in physical addresses that are not invalidated among theblocks including the invalidated pages, copies the valid data into afree block to move the valid data, and executes an erasing process onthe blocks, from which the copy has been made, to generate a new freeblock. The data storage device can generate a free block from a writedisabled block by performing the compaction. Even in a block where validdata is written by the move, if a non-written page exists, new writewith respect to the page is enabled.

According to this log-structured method, since a data written size and adata read size in the data storage device do not become so larger than adata write requested size requested from the host device, high randomwrite performance can be obtained. The lifespan of the semiconductorstorage element generally depends on an erase count or a write count. Inorder to increase the design lifespan of the data storage device, thedata written size in the data storage device is preferably smaller thanthe data write requested size requested from the host device.

Meanwhile, in an access pattern with respect to the data storage device,address locality generally exists. In the log-structured methoddescribed above, since the address locality of the access pattern is notconsidered, ordinary use performance cannot be sufficiently improved.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram showing an example of the hardwareconfiguration of a data storage device according to a first embodiment;

FIG. 2 is a block diagram showing an example of the functionalconfiguration of the data storage device according to the firstembodiment;

FIG. 3 is a diagram showing an example of a method for securingconsistency of management information;

FIG. 4 is a diagram showing an example of a method for securingconsistency of management information;

FIG. 5 is a diagram showing an example of a method for securingconsistency of management information;

FIG. 6 is a diagram showing an example of a method for securingconsistency of management information;

FIG. 7 is a block diagram showing an example of the functionalconfiguration of a data storage device according to a second embodiment;

FIG. 8 is a diagram showing an example of the data configuration of aforward lookup table;

FIG. 9 is a diagram showing an example of the data configuration of abackward lookup table, a valid page flag, and a valid page counter;

FIG. 10 is a diagram showing an example of the data configuration of ahost write log-structured pointer;

FIG. 11 is a diagram showing an example of a command dividing method;

FIG. 12 is a diagram showing an example of a log;

FIG. 13 is a flowchart showing an example of a write process of the datastorage device according to the second embodiment;

FIG. 14 is a flowchart showing an example of a read process of the datastorage device according to the second embodiment;

FIG. 15 is a flowchart showing an example of a compaction process of thedata storage device according to the second embodiment;

FIG. 16 is a flowchart showing an example of a snapshot recordingprocess of the data storage device according to the second embodiment;

FIG. 17 is a flowchart showing an example of a management informationrestoring process of the data storage device according to the secondembodiment;

FIG. 18 is a diagram showing a principle of arranging data in logicaladdress order;

FIG. 19 is a block diagram showing an example of the functionalconfiguration of a data storage device according to a third embodiment;

FIG. 20 is a diagram showing an example of the data configuration of avalid page flag and a valid page counter;

FIG. 21 is a diagram showing an allocating method of a non-used block;

FIG. 22 is a diagram showing an allocating method of a non-used block;

FIG. 23 is a diagram showing an allocating method of a non-used block;

FIG. 24 is a diagram showing an allocating method of a non-used block;

FIG. 25 is a diagram showing an allocating method of a non-used block;

FIG. 26 is a diagram showing an allocating method of a non-used block;

FIG. 27 is a diagram showing a write method of data with respect to apage;

FIG. 28 is a flowchart showing an example of a write process of the datastorage device according to the third embodiment;

FIG. 29 is a flowchart showing an example of a compaction process of thedata storage device according to the third embodiment;

FIG. 30 is a flowchart showing an example of a management informationrestoring process of the data storage device according to the thirdembodiment;

FIG. 31 is a flowchart showing an example of a block allocating processof the data storage device according to the third embodiment;

FIG. 32 is a flowchart showing an example of a block add completionprocess of the data storage device according to the third embodiment;

FIG. 33 is a flowchart showing an example of a free block collectingprocess of the data storage device according to the third embodiment;

FIG. 34 is a diagram showing an example of a restoring process that isnot in accordance with constraints;

FIG. 35 is a diagram showing an example of a restoring process that isnot in accordance with constraints;

FIG. 36 is a diagram showing an example of a restoring process that isnot in accordance with constraints;

FIG. 37 is a diagram showing an example of a restoring process that isnot in accordance with constraints;

FIG. 38 is a diagram showing an example of a restoring process that isnot in accordance with constraints;

FIG. 39 is a diagram showing an example of a restoring process that isin accordance with constraints;

FIG. 40 is a diagram showing an example of a restoring process that isin accordance with constraints;

FIG. 41 is a diagram showing an example of a restoring process that isin accordance with constraints;

FIG. 42 is a diagram showing an example of a restoring process that isin accordance with constraints;

FIG. 43 is a diagram showing an example of a restoring process that isin accordance with constraints;

FIG. 44 is a diagram showing an example of a restoring process that isin accordance with constraints;

FIG. 45 is a diagram showing an example of the data configuration of anLBA table;

FIG. 46 is a diagram showing an example of the data configuration of alogical/physical conversion table;

FIG. 47 is a diagram showing an example of the data configuration of abackward lookup table, a valid page flag, and a valid page counter; and

FIG. 48 is a diagram showing an example of an advancing method of alog-structured pointer.

DETAILED DESCRIPTION

In general, according to one embodiment, a write instructing unitinstructs a data access unit to write, in a storage area of a datastorage unit indicated by a first physical address, write object data,instructs a management information access unit to update addressconversion information, and instructs a first access unit to update thefirst physical address. A compaction unit extracts a physical address ofcompaction object data, instructs the data access unit to read thecompaction object data stored in a storage area of the data storage unitindicated by the physical address, instructs the data access unit towrite the compaction object data in a storage area of the data storageunit indicated by a second physical address, instructs the managementinformation access unit to update the address conversion information,and instructs a second access unit to update the second physicaladdress.

Hereinafter, a controller, a data storage device, and a programaccording to embodiments will be described in detail with reference tothe accompanying drawings. In the following embodiments, an SSD isexemplified as the data storage device, but the invention is not limitedthereto. In the following embodiments, the case where a data managementunit in the data storage device has a size equal to a page size isexemplified, but the invention is not limited thereto. For example, onepage may store plural data management units (data management unit mayhave a size smaller than the page size) or plural continuous pages maystore one data management unit (data management unit may have a sizelarger than the page size).

First Embodiment

In the first embodiment, the case where a storage area to store (add)write object data for a host write request and a storage area to addcompaction object data for compaction are independently secured isexemplified.

First, the configuration of the data storage device according to thefirst embodiment will be described.

FIG. 1 is a block diagram showing an example of the hardwareconfiguration of a data storage device 100 according to the firstembodiment. As shown in FIG. 1, the data storage device 100 includes aprocessor 51, a Boot read only memory (ROM) 52, a memory interface 53, adynamic random access memory (DRAM) 54, a SATA/SAS interface 55, NANDinterfaces 57A to 57F, NANDs (semiconductor storage media) 58A to 58F,and a bus 56 that connects these elements. In the description below,when the NAND interfaces 57A to 57F do not need to be distinguished fromeach other, the NAND interfaces 57A to 57F may be simply called the NANDinterface 57. Likewise, when the NANDs 58A to 58F do not need to bedistinguished from each other, the NANDs 58A to 58F may be simply calledthe NAND 58.

The Boot ROM 52 stores a program that is executed when power is suppliedto the data storage device 100. The NAND 58 stores various systemprograms. The SATA/SAS interface 55 controls communication with a hostdevice (not shown in the drawings), under the control of the processor51.

The processor 51 reads a program from the Boot ROM 52 and executes theprogram, when power is supplied, and transfers the various systemprograms stored in the NAND 58 to the DRAM 54 according to thecorresponding program. The processor 51 executes the system programsthat are transferred to the DRAM 54 to control the entire data storagedevice 100, and realizes various functions. Specifically, the processor51 executes the system programs that are transferred to the DRAM 54,interprets a command transmitted from the host device through theSATA/SAS interface 55, and controls write of data with respect to theNAND 58 or read of data from the NAND 58 according to the interpretedcommand. The processor 51 controls a compaction process as needed. Allor part of the various programs may be replaced by a circuit thatrealizes all or part of the processes realized by the various systemprograms.

The memory interface 53 controls the DRAM 54. The DRAM 54 stores thevarious data or programs. The NAND interface 57 controls the NAND 58 andincludes an error correcting circuit. The NAND 58 is composed of astorage element that is used in a NAND-type flash memory.

In an example shown in FIG. 1, the number of NANDs 58 is 6. This isbecause an access speed can be increased by connecting the plural NANDs58 and collectively performing an access. However, the number of NANDsis not limited to 6. In the first embodiment, a process in a block unitis exemplified. However, when the plural NANDs 58 are connected and anaccess is performed, the process can be executed in a unit called alogical block where the plural blocks are connected.

FIG. 2 is a block diagram showing an example of the outline of thefunctional configuration of the data storage device 100 according to thefirst embodiment. As shown in FIG. 2, the data storage device 100includes a receiver 110, a management information storage unit 120, amanagement information access unit 121, a first storage unit 130, afirst access unit 131, a second storage unit 140, a second access unit141, a write instructing unit 150, a read instructing unit 160, acompaction unit 170, a data storage unit 105, and a data access unit106.

The receiver 110 receives a write request from the host device. Thewrite request includes information of a logical address area thatcorresponds to a range of logical addresses where the host devicerequests to write data and write data specification information thatspecifies write object data. The logical address is a logical address ofthe data storage device 100 that can be recognized by the host device.The write data specification information is information of the writeobject data or information that includes information of a storage placeof the write object data.

The receiver 110 receives a read request from the host device. The readrequest includes information of a logical address area that correspondsto a range of logical addresses where the host device requests to readdata. The read request may include storage place information thatindicates a storage place of read data.

A function of the receiver 110 is realized by executing various systemprograms by the processor 51 and a function of the SATA/SAS interface55.

The management information storage unit 120 stores managementinformation. The management information that is information needed tooperate the data storage device 100 includes address conversioninformation in which a physical address and a logical address areassociated with each other. The physical address indicates a physicalstorage position of data that is stored in the data storage unit 105.

The first storage unit 130 stores a physical address which the writeinstructing unit 150 to be described below designates as the data writedestination.

The second storage unit 140 stores a physical address which thecompaction unit 170 to be described below designates as the data writedestination.

All of the management information storage unit 120, the first storageunit 130, and the second storage unit 140 are realized by predeterminedareas of the DRAM 54.

The management information access unit 121 receives a read instructionfrom the write instructing unit 150, the read instruction unit 160 orthe compaction unit 170, reads management information from themanagement information storage unit 120, and provides the readmanagement information to a read instruction origin (write instructingunit 150, the read instructing unit 160 or the compaction unit 170). Themanagement information access unit 121 receives a write instruction fromthe write instructing unit 150 or the compaction unit 170 and writes thewrite instructed management information in the management informationstorage unit 120.

The first access unit 131 receives a read instruction from the writeinstructing unit 150, reads a physical address from the first storageunit 130, and provides the read physical address to the writeinstructing unit 150. The first access unit 131 receives a writeinstruction from the write instructing unit 150 and writes the writeinstructed physical address in the first storage unit 130.

The second access unit 141 receives a read instruction from thecompaction unit 170, reads a physical address from the second storageunit 140, and provides the read physical address to the compaction unit170. The second access unit 141 receives a write instruction from thecompaction unit 170 and writes the write instructed physical address inthe second storage unit 140.

All of the management information access unit 121, the first access unit131, and the second access unit 141 are realized by a function of thememory interface 53.

The data storage unit 105 stores a variety of data such as user datawhere write is required from the host device. The data storage unit 105is realized by the NAND 58.

The data access unit 106 receives a read instruction from the writeinstructing unit 150, the read instruction unit 160 or the compactionunit 170, reads data from the data storage unit 105, and provides theread data to a read instruction origin (write instructing unit 150, theread instructing unit 160 or the compaction unit 170). The data accessunit 106 receives the write instruction from the write instructing unit150 or the compaction unit 170 and writes the write instructed data inthe data storage unit 105. The data access unit 106 is realized by afunction of the NAND interface 57.

The write instructing unit 150 refers to the write data specificationinformation that is included in the write request received by thereceiver 110 and acquires write object data. The write instructing unit150 instructs the first access unit 131 to read a physical addressstored in the first storage unit 130, and acquires the physical address.The write instructing unit 150 instructs the data access unit 106 towrite the acquired write object data in the storage position of the datastorage unit 105 indicated by the acquired physical address. The writeinstructing unit 150 instructs the management information access unit121 to write address conversion information of the write object datawritten in the data storage unit 105 in the management informationstorage unit 120. The write instructing unit 150 instructs the firstaccess unit 131 to update the physical address stored by the firststorage unit 130 and write the updated physical address.

The read instructing unit 160 extracts logical address area informationof the read object data that is included in the read request received bythe receiver 110. The read instructing unit 160 instructs the managementinformation access unit 121 to read management information stored in themanagement information storage unit 120, and acquires the managementinformation. The read instructing unit 160 extracts the physical addressfrom the acquired management information, using the extracted logicaladdress area information. The read instructing unit 160 instructs thedata access unit 106 to read the read object data from the storageposition of the data storage unit 105 indicated by the extractedphysical address, and acquires the read object data. The readinstructing unit 160 transmits a read reply to the host device throughthe receiver 110. The read reply is information of the read object dataor information that includes information indicating that the read objectdata is stored in the place specified by the storage place information.

The compaction unit 170 instructs the management information access unit121 to read the management information stored in the managementinformation storage unit 120, and acquires the management information.The compaction unit 170 extracts a physical address of the compactionobject data, using the acquired management information. When new data iswritten with respect to a certain logical address by the writeinstructing unit 150, the storage area of the data where write ispreviously performed with respect to the logical address indicating thesame value becomes an invalidated storage area. The compaction objectdata is data that is stored in a non-invalidated storage area.

The compaction unit 170 instructs the data access unit 106 to read thecompaction object data from the storage position of the data storageunit 105 indicated by the extracted physical address, and acquires thecompaction object data. The compaction unit 170 instructs the secondaccess unit 141 to read the physical address stored in the secondstorage unit 140, and acquires the physical address. The compaction unit170 instructs the data access unit 106 to write the acquired compactionobject data in the storage position of the data storage unit 105indicated by the acquired physical address. The compaction unit 170instructs the management information access unit 121 to write addressconversion information of the compaction object data written in the datastorage unit 105 in the management information storage unit 120. Thecompaction unit 170 instructs the second access unit 141 to update thephysical address stored by the second storage unit 140 and write theupdated physical address.

Functions of the write instructing unit 150, the read instructing unit160, and the compaction unit 170 are realized by executing varioussystem programs by the processor 51.

As described above, according to the first embodiment, since the storagearea to store (add) the write object data for the host write request andthe storage area to add the compaction object data for the compactionare independently secured, address locality of the access pattern can beconsidered and ordinary use performance can be improved.

Second Embodiment

In the first embodiment, the case where the storage area to store (add)the write object data for the host write request and the storage area toadd the compaction object data for the compaction are independentlysecured is exemplified. When the host write process and the compactionprocess are independently executed, the host write process and thecompaction process with respect to the same logical address area may beoverlapped to each other, and consistency of the management informationneeds to be secured.

Accordingly, in the second embodiment, the case where the managementinformation is finally updated to indicate a new page where data iswritten by the host write process, when the host write process and thecompaction process with respect to the same logical address area areoverlapped to each other, and consistency of the management informationis secured is exemplified.

First, a method for securing the consistency of the managementinformation will be described.

FIGS. 3 to 6 show a situation where the host write process and thecompaction process with respect to the same logical address area areoverlapped. In this situation, if the management information is finallyupdated to indicate a new page where data is written by the host writeprocess, the consistency of the management information can be secured.

In an example shown in FIG. 3, the compaction process first starts, thehost write process starts during the compaction process, and thecompaction process is completed before the host write process iscompleted. In this case, the management information is updated by boththe compaction process and the host write process, and the managementinformation indicates a new page where data is written by the host writerequest.

In an example shown in FIG. 4, the compaction process first starts, thehost write process starts during the compaction process, and the hostwrite process is completed before the compaction process is completed.In this case, the management information is not updated when thecompaction process ends, and the management information indicates a newpage where data is written by the host write request.

In an example shown in FIG. 5, the host write process first starts, thecompaction process starts during the host write process, and the hostwrite process is completed before the compaction process is completed.In this case, the management information is not updated when thecompaction process ends, and the management information indicates a newpage where data is written by the host write request.

In an example shown in FIG. 6, the host write process first starts, thecompaction process starts during the host write process, and thecompaction process is completed before the host write process iscompleted. In this case, the management information is updated by boththe compaction process and the host write process, and the managementinformation indicates a new page where data is written by the host writerequest.

If the data storage device loses the management information, the datastorage device cannot normally function. For this reason, it is neededto store the management information in the storage medium at arbitrarytiming and restore the stored management information as needed.

The management information needs to be stored, whenever the managementinformation is updated. However, if all of the management information isstored whenever the management information is updated, a storage timeincreases and the write amount with respect to the storage medium mayalso increase. Accordingly, all of the management information (snapshot)is stored at predetermined timing and differential information (log) isstored whenever the management information is updated.

The restoration of the management information is performed such that,after a newest snapshot stored in the storage medium is restored, a logthat is stored after storage of the snapshot is sequentially applied tothe restored snapshot in the order of time series. Thereby, managementinformation at a point of time when a log is finally recorded can berestored.

If the storage area for the host write request and the storage area forthe compaction are independently secured and the host write process andthe compaction process are independently executed, the write destinationbased on the host write request and the access destination of thecompaction process become discrete physical addresses on the storagemedium. In the case of the data storage device that uses a semiconductorstorage element such as the SSD as the storage medium, even though thecorresponding physical addresses are discrete physical addresses when anaccess is given to the storage medium, a time penalty does not exist orcan be ignored. Therefore, an advantageous effect that is obtained whenthe storage area for the host write request and the storage area for thecompaction are independently secured and the host write process and thecompaction process are independently executed increases. In the case ofa data storage device that uses a disk such as an HDD as the storagemedium, if corresponding physical addresses are discrete physicaladdresses when an access is given to the storage medium, a time penalty,such as a moving process time of a head or a rotation waiting time untilcueing of data on the disk is completed, increases. Therefore, anadvantageous effect that is obtained when the storage area for the hostwrite request and the storage area for the compaction are independentlysecured and the host write process and the compaction process areindependently executed decreases.

Next, the configuration of the data storage device according to thesecond embodiment will be described.

FIG. 7 is a block diagram showing an example of the detailed functionconfiguration of a data storage device 200 according to the secondembodiment. As shown in FIG. 7, the data storage device 200 includes asemiconductor storage medium control unit 203, a semiconductor storagemedium 205, a conversion table control unit 221, a conversion tablestorage unit 223, a host write log-structured pointer control unit 232,a host write log-structured pointer storage unit 230, a compactionlog-structured pointer control unit 242, a compaction log-structuredpointer storage unit 240, a block use information control unit 226, ablock use information storage unit 228, a buffer control unit 207, abuffer storage unit 209, a host interface unit 210, a command controlunit 215, a write instructing unit 250, a read instructing unit 260, acompaction unit 270, a snapshot storage unit 282, a log storage unit284, a management information restoring unit 290, a snapshot restoringunit 292, and a log restoring unit 294.

The semiconductor storage medium control unit 203 controls read/write ofdata with respect to the semiconductor storage medium 205, and givessupport to having access to the semiconductor storage medium 205 fromthe write instructing unit 250, the read instructing unit 260, thecompaction unit 270, the snapshot storage unit 282, the log storage unit284, the snapshot restoring unit 292, and the log restoring unit 294. Afunction of the semiconductor storage medium control unit 203 isrealized by executing various system programs by the processor 51 and afunction of the NAND interface 57.

If the semiconductor storage medium control unit 203 receives a readrequest of data of the designated physical address area from the writeinstructing unit 250, the read instructing unit 260 or the compactionunit 270, the semiconductor storage medium control unit 203 reads datafrom the designated physical address area of the semiconductor storagemedium 205 and provides the read data to a read request origin. If thesemiconductor storage medium control unit 203 receives write object dataand a write request of data with respect to the designated physicaladdress area from the write instructing unit 250, the read instructingunit 260 or the compaction unit 270, the semiconductor storage mediumcontrol unit 203 writes the received write object data in the designatedphysical address area of the semiconductor storage medium 205.

If a read request or a write request is continuously issued from thewrite instructing unit 250, the read instructing unit 260 or thecompaction unit 270, the semiconductor storage medium control unit 203continuously executes the requested processes. Now a situation isconsidered where a read request or write request is/has already beenseparately or continuously issued from a functional unit other than thefunctional unit issuing the continuous requests among the writeinstructing unit 250, the read instructing unit 260, and the compactionunit 270 to the semiconductor storage medium control unit 203. Forexample, a situation is considered where the compaction unit 270continuously issues the requests so that the semiconductor storagemedium control unit 203 is continuously executing the requestedprocesses, and a write request is issued from the write instructing unit250 or a write request has already been issued from the writeinstructing unit 250. In this case, the semiconductor storage mediumcontrol unit 203 does not execute a process of a next continuousrequest, but executes processes requested from the functional unit otherthan the functional unit issuing the continuous requests, as needed.That is, the semiconductor storage medium control unit 203 switches theprocess as needed. The semiconductor storage medium control unit 203executes a process of a next continuous request, as needed, if theprocess after the switching is completed. That is, the semiconductorstorage medium control unit 203 restarts the switched process as needed.

If the semiconductor storage medium control unit 203 receives an eraserequest of the designated block from the write instructing unit 250 orthe compaction unit 270, the semiconductor storage medium control unit203 executes an erasing process of the designated block of thesemiconductor storage medium 205.

If the semiconductor storage medium control unit 203 receives a datastorage request from the snapshot storage unit 282 or the log storageunit 284, the semiconductor storage medium control unit 203 stores thestorage requested data in a predetermined area of the semiconductorstorage medium 205 or in an area that can be traced from informationstored in the predetermined area of the semiconductor storage medium205.

If the semiconductor storage medium control unit 203 receives a dataread request from the snapshot restoring unit 292 or the log restoringunit 294, the semiconductor storage medium control unit 203 reads therequested data from a predetermined area of the semiconductor storagemedium 205 or from an area that can be traced from information stored inthe predetermined area of the semiconductor storage medium 205. Thesemiconductor storage medium control unit 203 provides the read data tothe snapshot restoring unit 292 or the log restoring unit 294.

The semiconductor storage medium 205 corresponds to the data storageunit 105 and is composed of a NAND-type flash memory. A storage element,such as the NAND-type flash memory, disables random read/write, enablesread/write in a unit called a page, and constructs a storage area of aunit called a block where plural pages are collected. The semiconductorstorage medium 205 is constructed by collecting plural blocks. Pluralsemiconductor storage media 205 may be connected.

The conversion table control unit 221 controls having access to theconversion table that is stored by the conversion table storage unit223, and gives support to having access to the conversion table storageunit 223 from the write instructing unit 250, the read instructing unit260, the compaction unit 270, the snapshot storage unit 282, thesnapshot restoring unit 292, and the log restoring unit 294. A functionof the conversion table control unit 221 is realized by executingvarious system programs by the processor 51 and a function of the memoryinterface 53.

The conversion table control unit 221 receives an access request withrespect to the conversion table, from the write instructing unit 250,the read instructing unit 260, the compaction unit 270, the snapshotstorage unit 282, the snapshot restoring unit 292 or the log restoringunit 294, and executes a process according to the received accessrequest.

The conversion table control unit 221 executes a lock process of theconversion table, such that the write instructing unit 250 or thecompaction unit 270 performs exclusive control of the conversion table.The conversion table control unit 221 performs a lock releasing processof the conversion table, such that the write instructing unit 250 or thecompaction unit 270 ends the exclusive control of the conversion table.

The conversion table storage unit 223 corresponds to a portion of themanagement information storage unit 120 and stores the conversion table.The conversion table includes a forward lookup table, a backward lookuptable, a valid page flag, and a valid page counter.

The forward lookup table is a table that indicates a correspondencerelationship of a logical address of data stored by the data storagedevice 200 and a physical address indicating a physical storage positionwhere the corresponding data is actually stored in the semiconductorstorage medium 205, and is used when the address is converted from thelogical address to the physical address. FIG. 8 shows an example of thedata configuration of the forward lookup table. As shown in FIG. 8, theforward lookup table uses the logical address as an index and includesthe logical address and the physical address as an entry. The physicaladdress includes a block number and a page number.

The backward lookup table is a table that indicates a correspondencerelationship of a logical address of data stored by the data storagedevice 200 and a physical address indicating a physical storage positionwhere the corresponding data is actually stored in the semiconductorstorage medium 205, and is used when the address is converted from thephysical address to the logical address, in contrast to the forwardlookup table. The valid page flag shows a valid page corresponding to apage where valid data is written among pages included in the block,using a true/false value. The valid page counter shows the number ofvalid pages among the pages included in the block.

FIG. 9 shows an example of the data configuration of the backward lookuptable, the valid page flag, and the valid page counter. As shown in FIG.9, the backward lookup table, the valid page flag, and the valid pagecounter use a block number as an index and include the block number, thevalid page counter, the logical address set, and the valid page flag setas an entry. The logical address set and the valid page flag set arearranged in order of the pages disposed in the block and can specify thepage of the logical address or the valid page flag. A value of the validpage counter of the same block and the total number of true values ofthe valid page flags are matched with each other. The block number thatbecomes the index and the block number that becomes the entry of theforward lookup table are assigned with the same number in the sameblock.

The host write log-structured pointer control unit 232 controls havingaccess to the host write log-structured pointer stored by the host writelog-structured pointer storage unit 230, and gives support to havingaccess to the host write log-structured pointer storage unit 230 fromthe write instructing unit 250, the snapshot storage unit 282, thesnapshot restoring unit 292, and the log restoring unit 294. A functionof the host write log-structured pointer control unit 232 is realized byexecuting various system programs by the processor 51 and a function ofthe memory interface 53.

The host write log-structured pointer control unit 232 receives anaccess request with respect to the host write log-structured pointer,from the write instructing unit 250, the snapshot storage unit 282, thesnapshot restoring unit 292 or the log restoring unit 294, and executesa process according to the received access request.

The host write log-structured pointer storage unit 230 corresponds tothe first storage unit 130 and stores the host write log-structuredpointer. FIG. 10 shows an example of the data configuration of the hostwrite log-structured pointer. As shown in FIG. 10, the host writelog-structured pointer includes a block number and a page number.Thereby, a physical address of a next page where data is written can berecognized.

The compaction log-structured pointer control unit 242 controls havingaccess to the compaction log-structured pointer that is stored by thecompaction log-structured pointer storage unit 240, and gives support tohaving access to the compaction log-structured pointer storage unit 240from the compaction unit 270, the snapshot storage unit 282, thesnapshot restoring unit 292, and the log restoring unit 294. A functionof the compaction log-structured pointer control unit 242 is realized byexecuting various system programs by the processor 51 and a function ofthe memory interface 53.

The compaction log-structured pointer control unit 242 receives anaccess request with respect to the compaction log-structured pointer,from the compaction unit 270, the snapshot storage unit 282, thesnapshot restoring unit 292 or the log restoring unit 294, and executesa process according to the received access request.

The compaction log-structured pointer storage unit 240 corresponds tothe second storage unit 140 and stores the compaction log-structuredpointer. Similar to the host write log-structured pointer shown in FIG.10, the compaction log-structured pointer includes a block number and apage number. Thereby, a physical address of a next page where data iswritten can be recognized.

The block use information control unit 226 controls having access toblock use information stored by the block use information storage unit228. The block use information indicates whether each block included inthe semiconductor storage medium 205 is a non-used block or a usedblock. In this case, the non-used block is a block where data is notwritten or a block that is collected as a new write destination block,because it is determined that the previously written data is invalidatedin all of the pages. The used block is a block that is previouslyallocated as a new write destination block and a block that is notcollected as the non-used block, because it is not yet determined thatthe written data is invalidated in all of the pages. The block useinformation control unit 226 gives support to having access to the blockuse information storage unit 228 from the write instructing unit 250,the compaction unit 270, the snapshot storage unit 282, the snapshotrestoring unit 292, and the log restoring unit 294. A function of theblock use information control unit 226 is realized by executing varioussystem programs by the processor 51 and a function of the memoryinterface 53.

The block use information control unit 226 receives an access requestwith respect to the block use information, from the write instructingunit 250, the compaction unit 270, the snapshot storage unit 282, thesnapshot restoring unit 292 or the log restoring unit 294, and executesa process according to the received access request.

The block use information storage unit 228 corresponds to a portion ofthe management information storage unit 120 and stores the block useinformation. In the block use information, information indicatingwhether each block included in the semiconductor storage medium 205 is anon-used block or a used block is associated with each block. Withrespect to the blocks determined as defective blocks when the datastorage device 200 is manufactured or operated, information indicatingthe defective blocks may be associated.

The buffer control unit 207 controls an input/output of data withrespect to the buffer storage unit 209, and gives support to havingaccess to the buffer storage unit 209 from the write instructing unit250, the read instructing unit 260, and the compaction unit 270. Afunction of the buffer control unit 207 is realized by executing varioussystem programs by the processor 51 and a function of the memoryinterface 53.

The buffer control unit 207 receives data to be input and a data inputrequest, from the write instructing unit 250, the read instructing unit260 or the compaction unit 270, and inputs the received data to thebuffer storage unit 209. The buffer control unit 207 receives a dataoutput request from the write instructing unit 250, the read instructingunit 260 or the compaction unit 270, outputs data corresponding to thereceived output request from the buffer storage unit 209, and providesthe data to the data output request origin.

The buffer storage unit 209 stores, as a buffer, data and is realized bya predetermined area of the DRAM 54.

The host interface unit 210 corresponds to a partial function of thereceiver 110 and controls communication between a host device such as aserver computer, a controller of a storage system, and a personalcomputer and the data storage device 200.

The host interface unit 210 receives a command including a write commandand a read command from the host device and issues a command executionnotification to the command control unit 215 to execute a processaccording to a kind of the received command. The write command includesa write destination logical address of the data storage device 200 and awrite data size. The read command includes a read destination logicaladdress of the data storage device 200 and a read data size.

If the host interface unit 210 receives a request for requesting thehost device to transmit data from the command control unit 215, the hostinterface unit 210 issues the received request for requesting the hostdevice to transmit data. If the host interface unit 210 receives datathat is transmitted from the host device and is to be received by thedata storage device 200, the host interface unit 210 transmits the datato the command control unit 215.

If the host interface unit 210 receives a request for requesting thehost device to receive data from the command control unit 215, the hostinterface unit 210 issues the received request for requesting the hostdevice to receive data. If the host interface unit 210 receives a datareception request from the host device, the host interface unit 210issues the received data reception request from the host device to thecommand control unit 215, and transmits the data, which is received fromthe command control unit 215 and is to be received by the host device,to the host device.

The command control unit 215 corresponds to a partial function of thereceiver 110. If the command control unit 215 receives a commandexecution notification from the host interface unit 210, the commandcontrol unit 215 distributes a process to the write instructing unit 250or the read instructing unit 260, according to the kind of the receivedcommand. A function of the command control unit 215 is realized byexecuting various system programs by the processor 51.

When the command control unit 215 receives a write command or a readcommand from the host interface unit 210 and an area for the command isover a boundary of a management size area (page), the command controlunit 215 divides the command by the boundary of the management sizearea. FIG. 11 shows a relationship between a write area of a writecommand, of which a write destination logical address is 3 and a writedata size is 16, and the boundary of the management size area in theconfiguration where a sector size is 512 bytes and a management size is4 kilobytes. In the case of an example shown in FIG. 11, the commandcontrol unit 215 divides the write command, of which the writedestination logical address is 3 and the write data size is 16, into awrite command having a write destination logical address of 3 and awrite data size of 5, a write command having a write destination logicaladdress of 8 and a write data size of 8, and a write command having awrite destination logical address of 16 and a write data size of 3. Thecommand control unit 215 notifies the write instructing unit 250 of thedivided command when the divided command is a write command, andnotifies the read instructing unit 260 of the divided command when thedivided command is a read command. When the area of the write command orthe read command received from the host interface unit 210 is not overthe boundary of the management size area, the command control unit 215notifies the write instructing unit 250 of the received command when thereceived command is a write command, and notifies the read instructingunit 260 of the received command when the received command is a readcommand.

If the command control unit 215 receives an execution notification of acommand other than the write command or the read command from the hostinterface unit 210, the command control unit 215 executes an appropriateprocess.

If the command control unit 215 receives a request for requesting thehost device to transmit data from the write instructing unit 250, thecommand control unit 215 transmits the received request for requestingthe host device to transmit data to the host interface unit 210. If thecommand control unit 215 receives data transmitted by the host devicefrom the host interface unit 210, the command control unit 215 transmitsthe received data to the write instructing unit 250.

If the command control unit 215 receives a request for requesting thehost device to receive data from the read instructing unit 260, thecommand control unit 215 transmits the received request for requestingthe host device to receive data to the host interface unit 210. If thecommand control unit 215 receives a data reception request from the hostdevice from the host interface unit 210, the command control unit 215transmits the received data reception request from the host device tothe read instructing unit 260. If the command control unit 215 receivesdata to be received by the host device from the read instructing unit260, the command control unit 215 transmits the received data to thehost interface unit 210.

The write instructing unit 250 executes a process that corresponds tothe write command. A function of the write instructing unit 250 isrealized by executing various system programs by the processor 51.

The write instructing unit 250 receives a write command (including writecommands that are divided by the command control unit 215) from thecommand control unit 215.

The write instructing unit 250 issues a request for requesting the hostdevice to transmit data to the command control unit 215. If the writeinstructing unit 250 receives data transmitted by the host device fromthe command control unit 215, the write instructing unit 250 issues astorage request of the received data to the buffer control unit 207.

With respect to the write commands divided by the command control unit215, the write instructing unit 250 may individually exchange data withthe host device as described above or the command control unit 215 orthe host interface unit 210 may collect the data and exchange the datawith the host device at one time.

When a write data size of the write command is less than a managementsize (for example, as in the example shown in FIG. 11, a command thatbecomes a write command having a write destination logical address of 3and a write data size of 5 as the division result: hereinafter, thecommand that becomes the write command having the write destinationlogical address of 3 and the write data size of 5 as the division resultis called the example shown in FIG. 11), the write instructing unit 250executes a padding process such that the write data becomes datacorresponding to the management size. Specifically, the writeinstructing unit 250 inquires the conversion table control unit 221 of aphysical address area that the remaining logical address area (area of alogical address of 0 and a data size of 3 in the example shown in FIG.11) corresponds, and acquires information of the physical address areathat the remaining logical address area corresponds. The writeinstructing unit 250 issues a read request of data of the acquiredphysical address area that the remaining logical address areacorresponds to the semiconductor storage medium control unit 203, andissues a storage request of the read data to the buffer control unit207. As a result, the buffer control unit 207 stores the datacorresponding to the management size in the buffer storage unit 209together with the data received from the command control unit 215.

The write instructing unit 250 inquires the host write log-structuredpointer control unit 232 of a current host write log-structured pointer,acquires the host write log-structured pointer, and acquires informationof a physical address area that the host write log-structured pointercorresponds.

The write instructing unit 250 issues an extraction request of thestored data corresponding to the management size to the buffer controlunit 207, transmits the extracted data and the information of thephysical address area that the acquired host write log-structuredpointer corresponds to the semiconductor storage medium control unit203, and requests the semiconductor storage medium control unit 203 towrite the extracted data in the physical address area that the acquiredhost write log-structured pointer corresponds. When the acquired hostwrite log-structured pointer indicates a head page of the block, thewrite instructing unit 250 requests the semiconductor storage mediumcontrol unit 203 to execute a block erasing process, before requestingthe semiconductor storage medium control unit 203 to write data.However, execution timing of the block erasing process is not limitedthereto. For example, the execution timing may be timing when a blockfor host write is newly allocated, timing when a block is collected as anon-used block or arbitrary timing during a period of time until thewrite instructing unit 250 requests the semiconductor storage mediumcontrol unit 203 to write data, after the block is collected as thenon-used block.

The write instructing unit 250 requests the conversion table controlunit 221 to resister a logical address of a head of the management sizearea including the area of the write command (logical address 0 in theexample shown in FIG. 11) in the corresponding backward lookup table ofthe physical address area that the acquired host write log-structuredpointer corresponds. The write instructing unit 250 notifies the logstorage unit 284 of update information of the updated conversion table.

The write instructing unit 250 requests the conversion table controlunit 221 to execute an exclusive control start process (lock process) ofthe conversion table.

The write instructing unit 250 updates the conversion table to indicatenewly written data, during the exclusive control of the conversiontable. Specifically, the write instructing unit 250 inquires theconversion table control unit 221 of a physical address (pre-updatephysical address) that corresponds to a logical address of the head ofthe management size area including the area of the write command(logical address 0 in the example shown in FIG. 11), before receivingthe write command. The write instructing unit 250 requests theconversion table control unit 221 to cause a valid page flag that theacquired pre-update physical address corresponds to become OFF. Thewrite instructing unit 250 requests the conversion table control unit221 to decrement a valid page counter of a block that the acquiredpre-update physical address corresponds. The write instructing unit 250requests the conversion table control unit 221 to cause a valid pageflag that the acquired host write log-structured pointer corresponds tobecome ON. The write instructing unit 250 requests the conversion tablecontrol unit 221 to increment a valid page counter of a block that theacquired host write log-structured pointer corresponds. The writeinstructing unit 250 requests the conversion table control unit 221 toupdate the logical address of the head of the management size areaincluding the area of the write command (logical address 0 in theexample shown in FIG. 11) of the forward lookup table to indicate theinformation of the physical address area that the host writelog-structured pointer corresponds. The write instructing unit 250notifies the log storage unit 284 of update information of the updatedconversion table.

The write instructing unit 250 requests the conversion table controlunit 221 to execute an exclusive control end process (lock releasingprocess) of the conversion table.

The write instructing unit 250 requests the host write log-structuredpointer control unit 232 to update the host write log-structured pointerto indicate a next page. The write instructing unit 250 inquires thehost write log-structured pointer control unit 232 of whether theupdated host write log-structured pointer is over the final page of theblock. If the write instructing unit 250 receives a reply indicatingthat the updated host write log-structured pointer is over the finalpage of the block, the write instructing unit 250 requests the block useinformation control unit 226 to execute an allocating process of anon-used block. As a result, the block use information is updated. Thewrite instructing unit 250 requests the host write log-structuredpointer control unit 232 to update the host write log-structured pointerto indicate a page of a head of a newly allocated block. The writeinstructing unit 250 notifies the log storage unit 284 of updateinformation of the updated host write log-structured pointer and updateinformation of the updated block use information.

The write instructing unit 250 requests the log storage unit 284 tocommit the update information notified to the log storage unit 284.

The read instructing unit 260 executes a process corresponding to theread command. A function of the read instructing unit 260 is realized byexecuting various system programs by the processor 51.

The read instructing unit 260 receives a read command (including readcommands that are divided by the command control unit 215) from thecommand control unit 215. The read instructing unit 260 inquires theconversion table control unit 221 of a physical address area that thelogical address area of the received read command corresponds, andacquires information of the corresponding physical address area.

The read instructing unit 260 issues a read request of data of theacquired physical address area to the semiconductor storage mediumcontrol unit 203, and issues a storage request of the read data to thebuffer control unit 207.

The read instructing unit 260 issues a request for requesting the hostdevice to receive data to the command control unit 215. If the readinstructing unit 260 receives a data reception request from the hostdevice from the command control unit 215, the read instructing unit 260issues an extraction request of the read data to the buffer control unit207 and delivers the extracted data to the command control unit 215.With respect to the read commands divided by the command control unit215, the read instructing unit 260 may individually exchange data withthe host device as described above or the command control unit 215 orthe host interface unit 210 may collect the data and exchange the datawith the host device at one time.

The compaction unit 270 executes a compaction process at timing when thecompaction process is needed or arbitrary timing. A function of thecompaction unit 270 is realized by executing various system programs bythe processor 51.

The compaction unit 270 inquires the block use information control unit226 of a block number of the used block, and acquires the block numberof the used block.

The compaction unit 270 inquires the conversion table control unit 221of the block suitable for a compaction object among the acquired blocks,and acquires the block number of the block suitable for the compactionobject and a valid page flag and a valid page counter of thecorresponding block. The block that is suitable for the compactionobject is a block where a value of the valid page counter is smallest.In this case, when the block where the value of the valid page counteris 0 is selected as the compaction object, the compaction unit 270requests the block use information control unit 226 to register thecorresponding block as a non-used block. As a result, the correspondingblock is collected as the non-used block. When the corresponding blockis collected as the non-used block, the compaction unit 270 notifies thelog storage unit 284 of update information of the updated block useinformation.

The compaction unit 270 issues a read request of a physical address areathat the acquired compaction object block number and valid page flaginformation correspond (copy origin page) to the semiconductor storagemedium control unit 203. If the compaction unit 270 receives the readdata, the compaction unit 270 issues a storage request of the receiveddata to the buffer control unit 207.

The compaction unit 270 inquires the compaction log-structured pointercontrol unit 242 of a current compaction log-structured pointer,acquires the compaction log-structured pointer, and acquires informationof the physical address area that the compaction log-structured pointercorresponds (copy destination page).

The compaction unit 270 issues an extraction request of the stored datato the buffer control unit 207, transmits the extracted data and theinformation of the physical address area that acquired compactionlog-structured pointer corresponds (copy destination page) to thesemiconductor storage medium control unit 203, and requests thesemiconductor storage medium control unit 203 to write the extracteddata in the physical address area that the acquired compactionlog-structured pointer corresponds (copy destination page). When theacquired compaction log-structured pointer indicates a head page of theblock, the compaction unit 270 requests the semiconductor storage mediumcontrol unit 203 to execute a block erasing process, before requestingthe semiconductor storage medium control unit 203 to write data.However, timing at which the block erasing process is executed is notlimited thereto. For example, the timing may be timing when a block forcompaction is newly allocated, timing when a block is collected as anon-used block or arbitrary timing during a period of time until thecompaction unit 270 requests the semiconductor storage medium controlunit 203 to write data, after the block is collected as the non-usedblock.

The compaction unit 270 requests the conversion table control unit 221to resister backward lookup logical address information of the physicaladdress area that the acquired compaction object block number and validpage flag information correspond (copy origin page) in the correspondingbackward lookup table of the physical address area that the acquiredcompaction log-structured pointer corresponds (copy destination page).The compaction unit 270 notifies the log storage unit 284 of updateinformation of the updated conversion table.

The compaction unit 270 requests the conversion table control unit 221to execute an exclusive control start process (lock process) of theconversion table.

The compaction unit 270 updates the conversion table to indicate data ofa compaction destination, during the exclusive control of the conversiontable. However, as described above, when a write process of the samelogical address area as a logical address area that data being copiedcorresponds is completed by the write instructing unit 250 during thecopy process of the data, the compaction unit 270 should not update theconversion table.

Specifically, the compaction unit 270 issues a reference request of theforward lookup table to the conversion table control unit 221 usingbackward lookup logical address information of the physical address areathat the acquired compaction object block number and valid page flaginformation correspond (copy origin page), and acquires a physicaladdress that corresponds to the backward lookup logical addressinformation. The compaction unit 270 determines whether the physicaladdress corresponding to the acquired backward lookup logical addressinformation and the physical address area that the acquired compactionobject block number and valid page flag information correspond (copyorigin page) are matched with each other. When it is determined that thephysical address and the physical address area are not matched with eachother, this means that the write process of the same logical addressarea as the logical address area that the data being copied correspondsis completed by the write instructing unit 250 during the copy processof the data. For this reason, the compaction unit 270 ends the processduring the exclusive control of the conversion table and does not updatethe conversion table. When it is determined that the physical addressand the physical address area are matched with each other, this meansthat the write process of the same logical address area as the logicaladdress area that the data being copied corresponds is not executed bythe write instructing unit 250 or executed but not completed during thecopy process of the data. For this reason, the compaction unit 270updates the conversion table.

Specifically, the compaction unit 270 requests the conversion tablecontrol unit 221 to cause a valid page flag of a physical address areathat the acquired compaction object block number and valid page flaginformation correspond (copy origin page) to become OFF. The compactionunit 270 requests the conversion table control unit 221 to decrement avalid page counter of a block that corresponds to the acquiredcompaction object block number. The compaction unit 270 requests theconversion table control unit 221 to cause a valid page flag of thephysical address area that the acquired compaction log-structuredpointer corresponds (copy destination page) to become ON. The compactionunit 270 requests the conversion table control unit 221 to increment avalid page counter of a block that the acquired compactionlog-structured pointer corresponds. The compaction unit 270 requests theconversion table control unit 221 to update an entry of the forwardlookup table indicated by the backward lookup logical address of thephysical address area that the acquired compaction object block numberand valid page flag information correspond (copy origin page) toindicate the physical address area information that the compactionlog-structured pointer corresponds (copy destination page). Thecompaction unit 270 notifies the log storage unit 284 of updateinformation of the updated conversion table. The compaction unit 270requests the block use information control unit 226 to register thecorresponding block as a non-used block, if the value of the valid pagecounter of the acquired compaction object block becomes 0. As a result,the corresponding block is collected as the non-used block. When thecorresponding block is collected as the non-used block, the compactionunit 270 notifies the log storage unit 284 of update information of theupdated block use information.

The compaction unit 270 requests the conversion table control unit 221to execute an exclusive control end process (lock releasing process) ofthe conversion table.

The compaction unit 270 requests the compaction log-structured pointercontrol unit 242 to update the compaction log-structured pointer toindicate a next page. The compaction unit 270 inquires the compactionlog-structured pointer control unit 242 of whether the updatedcompaction log-structured pointer is over the final page of the block.If the compaction unit 270 receives a reply indicating that the updatedcompaction log-structured pointer is over the final page of the block,the compaction unit 270 requests the block use information control unit226 to execute an allocating process of a non-used block. As a result,the block use information is updated. The compaction unit 270 requeststhe compaction log-structured pointer control unit 242 to update thecompaction log-structured pointer to indicate a page of a head of anewly allocated block. The compaction unit 270 notifies the log storageunit 284 of update information of the updated compaction log-structuredpointer and update information of the updated block use information.

The compaction unit 270 requests the log storage unit 284 to commit theupdate information notified to the log storage unit 284.

The snapshot storage unit 282 executes a snapshot storage process attiming when the snapshot storage process is needed or arbitrary timing.A function of the snapshot storage unit 282 is realized by executingvarious system programs by the processor 51.

The snapshot storage unit 282 requests the log storage unit 284 to storea log of information indicating a snapshot record start. Thereby, anorder relationship of record times of the snapshot and the log can berecognized.

The snapshot storage unit 282 requests the conversion table control unit221 to extract the conversion table, and acquires the conversion table.The snapshot storage unit 282 requests the host write log-structuredpointer control unit 232 to extract the host write log-structuredpointer, and acquires the host write log-structured pointer. Thesnapshot storage unit 282 requests the compaction log-structured pointercontrol unit 242 to extract the compaction log-structured pointer, andacquires the compaction log-structured pointer. The snapshot storageunit 282 requests the block use information control unit 226 to extractthe block use information, and acquires the block use information.

The snapshot storage unit 282 requests the semiconductor storage mediumcontrol unit 203 to store the acquired conversion table, the acquiredhost write log-structured pointer, the acquired compactionlog-structured pointer, and the acquired block use information, andrecords the snapshot. If a physical address of the semiconductor storagemedium 205 where the snapshot or the log is recorded cannot bepreviously recognized, the management information cannot be restoredwhen power is supplied to the data storage device 200. For this reason,the physical address of the semiconductor storage medium 205 where thesnapshot or the log is recorded is made to indicate a predetermined areaof the semiconductor storage medium 205 or an area that can be tracedfrom information recorded in the predetermined area of the semiconductorstorage medium 205.

The snapshot storage unit 282 requests the log storage unit 284 to storea log of information indicating a snapshot record end. Thereby, an orderrelationship of record times of the snapshot and the log can berecognized.

The log storage unit 284 executes a log storage process. A function ofthe log storage unit 284 is realized by executing various systemprograms by the processor 51.

The log storage unit 284 receives a notification of update informationof a variety of information from the write instructing unit 250 or thecompaction unit 270, and temporarily stores the received updateinformation.

The log storage unit 284 receives a commitment notification from thewrite instructing unit 250 or the compaction unit 270, requests thesemiconductor storage medium control unit 203 to store the temporarilystored update information, and records the temporarily stored updateinformation as a log. The log storage unit 284 receives a storagenotification of a log of information indicating a snapshot record startfrom the snapshot storage unit 282, requests the semiconductor storagemedium control unit 203 to store the received log of the informationindicating the snapshot record start, and records the information as thelog. The log storage unit 284 receives a storage notification of a logof information indicating a snapshot record end from the snapshotstorage unit 282, requests the semiconductor storage medium control unit203 to store the received log of the information indicating the snapshotrecord end, and records the information as the log.

An example of the log that the log storage unit 284 stores through thesemiconductor storage medium control unit 203 is shown in FIG. 12. Asshown in FIG. 12, the log storage unit 284 arranges logs in time seriesin reception order of log commitment process requests. In this case, ifit is detected that the record of the snapshot ends, since logs beforethe snapshot record start (logs 1 and 2 in an example shown in FIG. 12)and the previously recorded snapshot become unnecessary in a managementinformation restoring process, the log storage unit 284 frees the logsbefore the snapshot record start and the previously recorded snapshot asa new data storage area.

The management information restoring unit 290 executes a managementinformation restoring process, when the management information needs tobe restored. A function of the management information restoring unit 290is realized by executing various system programs by the processor 51.The management information restoring unit 290 requests the snapshotrestoring unit 292 to restore a newest snapshot. The managementinformation restoring unit 290 requests the log restoring unit 294 torestore management information from a log stored after storage of thenewest snapshot.

The snapshot restoring unit 292 restores the newest snapshot. A functionof the snapshot restoring unit 292 is realized by executing varioussystem programs by the processor 51.

If the snapshot restoring unit 292 receives a restoration request of thenewest snapshot from the management information restoring unit 290, thesnapshot restoring unit 292 issues an extraction request of the newestsnapshot to the semiconductor storage medium control unit 203, andreceives the newest snapshot.

The snapshot restoring unit 292 extracts the conversion table from thereceived snapshot, and requests the conversion table control unit 221 tostore the extracted conversion table. The snapshot restoring unit 292extracts the host write log-structured pointer from the receivedsnapshot, and requests the host write log-structured pointer controlunit 232 to store the extracted host write log-structured pointer. Thesnapshot restoring unit 292 extracts the compaction log-structuredpointer from the received snapshot, and requests the compactionlog-structured pointer control unit 242 to store the extractedcompaction log-structured pointer. The snapshot restoring unit 292extracts the block use information from the received snapshot, andrequests the block use information control unit 226 to store theextracted block use information.

The log restoring unit 294 restores the management information from thelog stored after storage of the newest snapshot. A function of the logrestoring unit 294 is realized by executing various system programs bythe processor 51.

If the log restoring unit 294 receives a restoration request of themanagement information from the log stored after storage of the newestsnapshot from the management information restoring unit 290, the logrestoring unit 294 issues an extraction request of the log stored afterstorage of the newest snapshot to the semiconductor storage mediumcontrol unit 203, and receives the log stored after storage of thenewest snapshot. The log restoring unit 294 extracts the logs from thereceived logs in record order, and requests the conversion table controlunit 221, the host write log-structured pointer control unit 232, thecompaction log-structured pointer control unit 242 or the block useinformation control unit 226 to reflect update information of a varietyof information recorded in the logs.

Next, the operation of the data storage device according to the secondembodiment will be described.

First, a sequence of a write process that is executed by the datastorage device 200 according to a write command from the host devicewill be described with reference to FIG. 13. FIG. 13 is a flowchartshowing an example of a flow of a sequence of the write process executedby the data storage device 200. The data storage device 200 previouslysecures a non-used block to be used for the write command from the hostdevice, in preparation for the write command from the host device.

In step S1, the host interface unit 210 receives the write command fromthe host device and issues a command execution notification to thecommand control unit 215 to execute a process according to the kind ofthe received command.

In step S2, if the command control unit 215 receives the write commandfrom the host interface unit 210, the command control unit 215investigates whether an area of the corresponding command is over theboundary of the management size area (page). When the area of thecorresponding command is over the boundary of the management size area(page) (Yes in step S2), the process proceeds to step S3. Meanwhile,when the area of the corresponding command is not over the boundary ofthe management size area (page) (No in step S2), the process proceeds tostep S4.

In step S3, the command control unit 215 divides the correspondingcommand by the boundary of the management size area. For example, asshown in FIG. 11, the command control unit 215 divides a write command,of which a write destination logical address is 3 and a write data sizeis 16, into a write command having a write destination logical addressof 3 and a write data size of 5, a write command having a writedestination logical address of 8 and a write data size of 8, and a writecommand having a write destination logical address of 16 and a writedata size of 3.

In step S4, the command control unit 215 notifies the write instructingunit 250 of the divided commands. When the area of the write commandreceived from the host interface unit 210 is not over the boundary ofthe management size area, the command control unit 215 notifies thewrite instructing unit 250 of the received command. Accordingly, thewrite instructing unit 250 repetitively executes the followingprocesses, when the write command is divided.

In step S5, the write instructing unit 250 issues a request forrequesting the host device to transmit data to the command control unit215. If the command control unit 215 receives the request for requestingthe host device to transmit data from the write instructing unit 250,the command control unit 215 transmits the received request forrequesting the host device to transmit data to the host interface unit210. If the host interface unit 210 receives the request for requestingthe host device to transmit data from the command control unit 215, thehost interface unit 210 issues the received request for requesting thehost device to transmit data to the host device. If the host interfaceunit 210 receives data to be received by the data storage device 200from the host device, the host interface unit 210 transmits the data tobe received by the data storage device 200 to the command control unit215. If the command control unit 215 receives the data transmitted bythe host device from the host interface unit 210, the command controlunit 215 transmits the received data to the write instructing unit 250.If the write instructing unit 250 receives the data transmitted by thehost device from the command control unit 215, the write instructingunit 250 issues a storage request of the received data to the buffercontrol unit 207. With respect to the write commands divided by thecommand control unit 215, the write instructing unit 250 mayindividually exchange data with the host device as described above orthe command control unit 215 or the host interface unit 210 may collectthe data and exchange the data with the host device at one time. Thebuffer control unit 207 stores the designated data in the buffer storageunit 209.

In step S6, the write instructing unit 250 investigates whether thewrite data size of the write command is less than the management size.When the write data size is less than the management size (Yes in stepS6), the process proceeds to step S7. When the write data size is notless than the management size (equal to the management size) (No in stepS6), the process proceeds to step S8. The case where the write data sizeis less than the management size is the case of the write command havingthe write destination logical address of 3 and the write data size of 5,as in the example shown in FIG. 11.

In step S7, the write instructing unit 250 inquires the conversion tablecontrol unit 221 of a physical address area that the remaining logicaladdress area (area having the logical address of 0 and the data size of3 in the example shown in FIG. 11) corresponds. The conversion tablecontrol unit 221 refers to the conversion table stored by the conversiontable storage unit 223, and provides information of the correspondingphysical address area. The write instructing unit 250 acquiresinformation of the physical address area that the acquired remaininglogical address area corresponds, and issues a read request of data ofthe physical address area that the remaining logical address areacorresponds to the semiconductor storage medium control unit 203. Thesemiconductor storage medium control unit 203 reads the data of thedesignated physical address area of the semiconductor storage medium 205and provides the data. When the write request or the read request iscontinuously issued from the write instructing unit 250 and therequested processes are continuously executed, and the read request orthe write request is issued from the read instructing unit 260 or thecompaction unit 270 or has already been issued, the semiconductorstorage medium control unit 203 does not execute a process of a nextcontinuous request and executes a process requested from the readinstructing unit 260 or the compaction unit 270, as needed. That is, thesemiconductor storage medium control unit 203 switches the process asneeded. The semiconductor storage medium control unit 203 executes aprocess of a next continuous request, as needed, if the process afterthe switching is completed. That is, the semiconductor storage mediumcontrol unit 203 restarts the switched process as needed. The writeinstructing unit 250 issues a storage request of the read data to thebuffer control unit 207. As a result, the buffer control unit 207 storesthe data corresponding to the management size in the buffer storage unit209 together with the data received from the command control unit 215.The buffer control unit 207 stores the designated data in the bufferstorage unit 209.

In step S8, the write instructing unit 250 inquires the host writelog-structured pointer control unit 232 of a current host writelog-structured pointer. The host write log-structured pointer controlunit 232 provides the host write log-structured pointer stored by thehost write log-structured pointer storage unit 230. The writeinstructing unit 250 acquires the host write log-structured pointer andacquires information of the physical address area that the host writelog-structured pointer corresponds. The write instructing unit 250issues an extraction request of the stored data corresponding to themanagement size to the buffer control unit 207. The buffer control unit207 extracts the designated data that is stored by the buffer storageunit 209 and provides the designated data. The write instructing unit250 transmits the extracted data and the physical address areainformation that the acquired host write log-structured pointercorresponds to the semiconductor storage medium control unit 203, andrequests the semiconductor storage medium control unit 203 to write theextracted data in the physical address area that the extracted hostwrite log-structured pointer corresponds. When the acquired host writelog-structured pointer indicates a head page of the block, the writeinstructing unit 250 requests the semiconductor storage medium controlunit 203 to execute a block erasing process, before requesting thesemiconductor storage medium control unit 203 to write data. However,execution timing of the block erasing process is not limited thereto.For example, the execution timing may be timing when a block for hostwrite is newly allocated, timing when a block is collected as a non-usedblock or arbitrary timing during a period of time until the writeinstructing unit 250 requests the semiconductor storage medium controlunit 203 to write data, after the block is collected as the non-usedblock. The semiconductor storage medium control unit 203 writes thedesignated data in the designated physical address area of thesemiconductor storage medium. When the write request or the read requestis continuously issued from the write instructing unit 250 and therequested processes are continuously executed, and the read request orthe write request is issued from the read instructing unit 260 or thecompaction unit 270 or has already been issued, the semiconductorstorage medium control unit 203 does not execute a process of a nextcontinuous request and executes a process requested from the readinstructing unit 260 or the compaction unit 270, as needed. That is, thesemiconductor storage medium control unit 203 switches the process asneeded. The semiconductor storage medium control unit 203 executes aprocess of a next continuous request, as needed, if the process afterthe switching is completed. That is, the semiconductor storage mediumcontrol unit 203 restarts the switched process as needed.

In step S9, the write instructing unit 250 requests the conversion tablecontrol unit 221 to register the logical address of the head of themanagement size area including the area of the write command (logicaladdress 0 in the example shown in FIG. 11) in the backward lookup tablethat the acquired host write log-structured pointer corresponds. Theconversion table control unit 221 registers the logical address of thehead of the management size area including the area of the write command(logical address 0 in the example shown in FIG. 11) in the backwardlookup table which is the conversion table stored by the conversiontable storage unit 223 and to which the acquired host writelog-structured pointer corresponds. The write instructing unit 250notifies the log storage unit 284 of update information of the updatedconversion table. The log storage unit 284 receives the updateinformation of the updated conversion table.

In step S10, the write instructing unit 250 requests the conversiontable control unit 221 to execute an exclusive control start process(lock process) of the conversion table. The conversion table controlunit 221 executes the exclusive control start process (lock process) ofthe conversion table.

In step S11, the write instructing unit 250 inquires the conversiontable control unit 221 of a physical address (pre-update physicaladdress) that corresponds to the logical address of the head of themanagement size area including the area of the write command (logicaladdress 0 in the example shown in FIG. 11), before receiving the writecommand. The conversion table control unit 221 refers to the conversiontable that is stored by the conversion table storage unit 223, acquiresthe physical address (pre-update physical address) that corresponds tothe logical address of the head of the management size area includingthe area of the write command (logical address 0 in the example shown inFIG. 11), before receiving the write command, and provides the physicaladdress. The write instructing unit 250 acquires the physical address(pre-update physical address) that corresponds to the logical address ofthe head of the management size area including the area of the writecommand (logical address 0 in the example shown in FIG. 11), beforereceiving the write command.

In step S12, the write instructing unit 250 requests the conversiontable control unit 221 to cause a valid page flag that the acquiredpre-update physical address corresponds to become OFF. In step S13, thewrite instructing unit 250 requests the conversion table control unit221 to decrement a valid page counter of a block that the acquiredpre-update physical address corresponds. In step S14, the writeinstructing unit 250 requests the conversion table control unit 221 tocause a valid page flag that the acquired host write log-structuredpointer corresponds to become ON. In step S15, the write instructingunit 250 requests the conversion table control unit 221 to increment avalid page counter of a block that the acquired host writelog-structured pointer corresponds. In step S16, the write instructingunit 250 requests the conversion table control unit 221 to update thelogical address of the head of the management size area including thearea of the write command (logical address 0 in the example shown inFIG. 11) of the forward lookup table to indicate the information of thephysical address area that the host write log-structured pointercorresponds. The conversion table control unit 221 updates theconversion table stored by the conversion table storage unit 223according to an instruction. The write instructing unit 250 notifies thelog storage unit 284 of update information of the updated conversiontable.

In step S17, the write instructing unit 250 requests the conversiontable control unit 221 to execute an exclusive control end process (lockreleasing process) of the conversion table. The conversion table controlunit 221 executes the exclusive control end process (lock releasingprocess) of the conversion table.

In step S18, the write instructing unit 250 requests the host writelog-structured pointer control unit 232 to update the host writelog-structured pointer to indicate a next page. The host writelog-structured pointer control unit 232 updates the host writelog-structured pointer to indicate a next page. The write instructingunit 250 notifies the log storage unit 284 of update information of theupdated host write log-structured pointer.

In step S19, the write instructing unit 250 inquires the host writelog-structured pointer control unit 232 of whether the updated hostwrite log-structured pointer is over the final page of the block. Thehost write log-structured pointer control unit 232 investigates whetherthe updated host write log-structured pointer is over the final page ofthe block and provides the investigation result. If the writeinstructing unit 250 receives a reply indicating that the updated hostwrite log-structured pointer is over the final page of the block, theprocess proceeds to step S20. Otherwise, the process proceeds to stepS21.

In step S20, the write instructing unit 250 requests the block useinformation control unit 226 to execute an allocating process of anon-used block. As a result, the block use information is updated. Theblock use information control unit 226 selects the block of the non-usedstate from the block use information stored by the block use informationstorage unit 228, allocates the non-used block, and updates the blockuse information. The write instructing unit 250 requests the host writelog-structured pointer control unit 232 to update the host writelog-structured pointer to indicate a page of a head of a newly allocatedblock. The host write log-structured pointer control unit 232 updatesthe host write log-structured pointer stored by the host writelog-structured pointer storage unit 230 to indicate a page of a head ofa newly allocated block. The write instructing unit 250 notifies the logstorage unit 284 of update information of the updated host writelog-structured pointer and updated information of the updated block useinformation.

In step S21, the write instructing unit 250 requests the log storageunit 284 to commit the update information notified to the log storageunit 284. The log storage unit 284 receives a commitment notificationfrom the write instructing unit 250, and requests the semiconductorstorage medium control unit 203 to store the temporarily stored updateinformation. The semiconductor storage medium control unit 203 recordsthe temporarily stored update information as a log. If the physicaladdress of the semiconductor storage medium 205 where the log isrecorded cannot be previously recognized, the management informationcannot be restored when power is supplied to the data storage device200. For this reason, the physical address of the semiconductor storagemedium 205 where the log is recorded is made to indicate a predeterminedarea of the semiconductor storage medium 205 or an area that can betraced from information recorded in the predetermined area of thesemiconductor storage medium 205.

In step S22, the process is repeated from step S4, as needed.

Next, a sequence of a read process that is executed by the data storagedevice 200 according to a read command from the host device will bedescribed with reference to FIG. 14. FIG. 14 is a flowchart showing anexample of a flow of a sequence of the read process executed by the datastorage device 200. In this case, it is assumed that the read requesteddata is previously written by the write command.

In step S31, the host interface unit 210 receives a read command fromthe host device and issues a command execution notification to thecommand control unit 215 to execute a process according to a kind of thereceived command.

In step S32, if the command control unit 215 receives the read commandfrom the host interface unit 210, the command control unit 215investigates whether the area of the corresponding command is over theboundary of the management size area (page). When the area of thecorresponding command is over the boundary of the management size area(page) (Yes in step S32), the process proceeds to step S33. When thearea of the corresponding command is not over the boundary of themanagement size area (page) (No in step S32), the process proceeds tostep S34.

In step S33, the command control unit 215 divides the correspondingcommand by the boundary of the management size area. The commanddividing process is the same as that in the case of the write process.

In step S34, the command control unit 215 notifies the read instructingunit 260 of the divided commands. When the area of the read commandreceived from the host interface unit 210 is not over the boundary ofthe management size area, the command control unit 215 notifies the readinstructing unit 260 of the received command. Accordingly, when the readcommand is divided, the read instructing unit 260 repetitively executesthe following processes.

In step S35, the read instructing unit 260 inquires the conversion tablecontrol unit 221 of a physical address area that the logical addressarea of the received read command corresponds, and acquires informationof the corresponding physical address area. The conversion table controlunit 221 refers to the conversion table that is stored by the conversiontable storage unit 223, and provides the physical address areainformation that the logical address area of the received read commandcorresponds. The read instructing unit 260 acquires the physical addressarea information that the logical address area of the received readcommand corresponds.

In step S36, the read instructing unit 260 issues a read request of dataof the acquired physical address area to the semiconductor storagemedium control unit 203. The semiconductor storage medium control unit203 reads the data of the designated physical address area of thesemiconductor storage medium and provides the data. When the readrequest is continuously issued from the read instructing unit 260 andthe requested processes are continuously executed, and the read requestor the write request is issued from the write instructing unit 250 orthe compaction unit 270 or has already been issued, the semiconductorstorage medium control unit 203 does not execute a process of a nextcontinuous request and executes a process requested from the writeinstructing unit 250 or the compaction unit 270, as needed. That is, thesemiconductor storage medium control unit 203 switches the process asneeded. The semiconductor storage medium control unit 203 executes aprocess of a next continuous request, as needed, if the process afterthe switching is completed. That is, the semiconductor storage mediumcontrol unit 203 restarts the switched process as needed. The readinstructing unit 260 issues a storage request of the read data to thebuffer control unit 207. The buffer control unit 207 stores thedesignated data in the buffer storage unit 209.

In step S37, the read instructing unit 260 issues a request forrequesting the host device to receive data to the command control unit215. If the command control unit 215 receives the request for requestingthe host device to receive data from the read instructing unit 260, thecommand control unit 215 transmits the received request for requestingthe host device to receive data to the host interface unit 210. If thehost interface unit 210 receives the request for requesting the hostdevice to receive data from the command control unit 215, the hostinterface unit 210 issues the received request for requesting the hostdevice to receive data. If the host interface unit 210 receives a datareception request from the host device, the host interface unit 210issues the received data reception request from the host device to thecommand control unit 215. If the command control unit 215 receives thedata reception request from the host device through the host interfaceunit 210, the command control unit 215 transmits the received datareception request from the host device to the read instructing unit 260.If the read instructing unit 260 receives the data reception requestfrom the host device from the command control unit 215, the readinstructing unit 260 issues an extraction request of the read data tothe buffer control unit 207. The buffer control unit 207 extracts thedesignated data that is stored by the buffer storage unit 209 andprovides the extracted data. The read instructing unit 260 delivers theextracted data to the command control unit 215. If the command controlunit 215 receives data to be received by the host device from the readinstructing unit 260, the command control unit 215 transmits thereceived data to the host interface unit 210. The host interface unit210 transmits the data, which is received from the command control unit215 and is to be received by the host device, to the host device. Withrespect to the read commands divided by the command control unit 215,the read instructing unit 260 may individually exchange data with thehost device as described above or the command control unit 215 or thehost interface unit 210 may collect the data and exchange the data withthe host device at one time.

In step S38, the process is repeated from step S34, as needed.

Next, a sequence of a compaction process that is executed by the datastorage device 200 will be described with reference to FIG. 15. FIG. 15is a flowchart showing an example of a flow of a sequence of thecompaction process executed by the data storage device 200. The datastorage device 200 executes the compaction process at timing when thecompaction process is needed or arbitrary timing. The timing at whichthe compaction process is needed can be determined by determiningwhether the number of non-used blocks recorded in the block useinformation is less than the predetermined threshold value.

In step S41, the compaction unit 270 inquires the block use informationcontrol unit 226 of a block number of the used block. The block useinformation control unit 226 refers to the block use information that isstored by the block use information storage unit 228, and provides theblock number of the used block. The compaction unit 270 acquires theblock number of the used block. The compaction unit 270 inquires theconversion table control unit 221 of the block suitable for a compactionobject among the acquired blocks and the valid page flag and the validpage counter of the corresponding block. The block that is suitable forthe compaction object is a block where a value of the valid page counteris smallest. The conversion table control unit 221 refers to theconversion table that is stored by the conversion table storage unit223, extracts the block suitable for the compaction object among theacquired blocks, and provides the block number of the block suitable forthe compaction object, the valid page flag and the valid page counter ofthe corresponding block. The compaction unit 270 acquires the blocknumber of the block suitable for the compaction object, the valid pageflag and the valid page counter of the corresponding block.

In step S42, the compaction unit 270 investigates whether the value ofthe valid page counter of the block selected as the compaction object is0. When the value is 0, the process proceeds to step S43. When the valueis not 0, the process proceeds to step S44.

In step S43, the compaction unit 270 requests the block use informationcontrol unit 226 to register the corresponding block as a non-usedblock. As a result, the corresponding block is collected as the non-usedblock. The block use information control unit 226 registers thecorresponding block as the non-used block in the block use informationstored by the block use information storage unit 228. As a result, thecorresponding block is collected as the non-used block. The compactionunit 270 notifies the log storage unit 284 of update information of theupdated block use information. Then, the process returns to step S41.

In step S44, the compaction unit 270 temporarily stores the acquiredcompaction object block number and valid page flag information.

In step S45, the compaction unit 270 repetitively executes the followingprocesses, with respect to pages where the acquired valid page flaginformation is ON.

In step S46, the compaction unit 270 issues a read request of a physicaladdress area that the acquired compaction object block number and validpage flag information correspond (copy origin page) to the semiconductorstorage medium control unit 203. The semiconductor storage mediumcontrol unit 203 reads data of the designated physical address area ofthe semiconductor storage medium and provides the data. When the writerequest or the read request is continuously issued from the compactionunit 270 and the requested processes are continuously executed, and theread request or the write request is issued from the read instructingunit 260 or the write instructing unit 250 or has already been issued,the semiconductor storage medium control unit 203 does not execute aprocess of a next continuous request and executes a process requestedfrom the read instructing unit 260 or the write instructing unit 250, asneeded. That is, the semiconductor storage medium control unit 203switches the process as needed. The semiconductor storage medium controlunit 203 executes a process of a next continuous request, as needed, ifthe process after the switching is completed. That is, the semiconductorstorage medium control unit 203 restarts the switched process as needed.If the compaction unit 270 receives the read data, the compaction unit270 issues a storage request of the received data to the buffer controlunit 207. The buffer control unit 207 stores the designated data in thebuffer storage unit 209.

In step S47, the compaction unit 270 inquires the conversion tablecontrol unit 221 of the backward lookup logical address information ofthe physical address area that the acquired compaction object blocknumber and valid page flag information correspond (copy origin page).The conversion table control unit 221 refers to the conversion tablethat is stored by the conversion table storage unit 223, and providesthe backward lookup logical address information of the physical addressarea that the acquired compaction object block number and valid pageflag information correspond (copy origin page). The compaction unit 270acquires the backward lookup logical address information of the physicaladdress area that the acquired compaction object block number and validpage flag information correspond (copy origin page).

In step S48, the compaction unit 270 inquires the compactionlog-structured pointer control unit 242 of a current compactionlog-structured pointer. The compaction log-structured pointer controlunit 242 provides the compaction log-structured pointer that is storedby the compaction log-structured pointer storage unit 240. Thecompaction unit 270 acquires the information of the physical addressarea that the compaction log-structured pointer corresponds (copydestination page). The compaction unit 270 issues an extraction requestof the stored data to the buffer control unit 207. The buffer controlunit 207 extracts the designated data that is stored by the bufferstorage unit 209 and provides the extracted data. The compaction unit270 acquires the storage data. The compaction unit 270 transmits theextracted data and the information of the physical address area that theacquired compaction log-structured pointer corresponds (copy destinationpage) to the semiconductor storage medium control unit 203, and requeststhe semiconductor storage medium control unit 203 to write the extracteddata in the physical address area that the acquired compactionlog-structured pointer corresponds (copy destination page). When theacquired compaction log-structured indicates a head page of the block,the compaction unit 270 requests the semiconductor storage mediumcontrol unit 203 to execute a block erasing process, before requestingthe semiconductor storage medium control unit 203 to write data.However, timing at which the block erasing process is executed is notlimited thereto. For example, the timing may be timing when a block forcompaction is newly allocated, timing when a block is collected as anon-used block or arbitrary timing during a period of time until thecompaction unit 270 requests the semiconductor storage medium controlunit 203 to write data, after the block is collected as the non-usedblock. The semiconductor storage medium control unit 203 writes thedesignated data in the designated physical address area of thesemiconductor storage medium 205. When the write request or the readrequest is continuously issued from the compaction unit 270 and therequested processes are continuously executed, and the read request orthe write request is issued from the read instructing unit 260 or thewrite instructing unit 250 or has already been issued, the semiconductorstorage medium control unit 203 does not execute a process of a nextcontinuous request and executes a process requested from the readinstructing unit 260 or the write instructing unit 250, as needed. Thatis, the semiconductor storage medium control unit 203 switches theprocess as needed. The semiconductor storage medium control unit 203executes a process of a next continuous request, as needed, if theprocess after the switching is completed. That is, the semiconductorstorage medium control unit 203 restarts the switched process as needed.

In step S49, the compaction unit 270 requests the conversion tablecontrol unit 221 to resister corresponding backward lookup logicaladdress information of the physical address area that the acquiredcompaction object block number and valid page flag informationcorrespond (copy origin page), in the corresponding backward lookuptable of the physical address area that the acquired compactionlog-structured pointer corresponds (copy destination page). Theconversion table control unit 221 resisters the corresponding backwardlookup logical address information of the physical address area that theacquired compaction object block number and valid page flag informationcorrespond (copy origin page), in the corresponding backward lookuptable of the physical address area that the acquired compactionlog-structured pointer corresponds (copy destination page), in theconversion table that is stored by the conversion table storage unit223. The compaction unit 270 notifies the log storage unit 284 of updateinformation of the updated conversion table.

In step S50, the compaction unit 270 requests the conversion tablecontrol unit 221 to execute an exclusive control start process (lockprocess) of the conversion table. The conversion table control unit 221executes an exclusive control start process (lock process) of theconversion table.

In step S51, the compaction unit 270 issues a reference request of theforward lookup table to the conversion table control unit 221 usingcorresponding backward lookup logical address information of thephysical address area that the acquired compaction object block numberand valid page flag information correspond (copy origin page). Theconversion table control unit 221 refers to the conversion table that isstored by the conversion table storage unit 223, refers to the forwardlookup table using the corresponding backward lookup logical addressinformation of the physical address area that the acquired compactionobject block number and valid page flag information correspond (copyorigin page), and provides information of a physical address area thatcorresponds to the backward lookup logical address information. Thecompaction unit 270 acquires a physical address area that corresponds tothe backward lookup logical address information.

In step S52, the compaction unit 270 determines whether the physicaladdress area corresponding to the acquired backward lookup logicaladdress information and the physical address area that the acquiredcompaction object block number and valid page flag informationcorrespond (copy origin page) are matched with each other. As describedabove, when the write process of the same logical address area as thelogical address area that the data being copied corresponds is completedby the write instructing unit 250 during the copy process of the data,the conversion table is not updated. When it is determined that thephysical address areas are not matched (No in step S52), this means thatthe write process of the same logical address area as the logicaladdress area being copied corresponds is completed by the writeinstructing unit 250 during the copy process of the data. For thisreason, the process proceeds to step S60 and the conversion table shouldnot be updated. When it is determined that the physical address areasare matched (Yes in step S52), this means that the write process of thesame logical address area as the logical address area that the databeing copied corresponds is not executed by the write instructing unit250 or executed but not completed during the copy process of the data.For this reason, the process proceeds to step S53 and the conversiontable is updated.

In step S53, the compaction unit 270 requests the conversion tablecontrol unit 221 to cause a valid page flag of a physical address areathat the acquired compaction object block number and valid page flaginformation correspond (copy origin page) to become OFF. In step S54,the compaction unit 270 requests the conversion table control unit 221to decrement a valid page counter of a block that corresponds to theacquired compaction object block number. In step S56, if the value ofthe valid page counter of the acquired compaction object block becomes 0(Yes in step S55), the compaction unit 270 requests the block useinformation control unit 226 to register the corresponding block as anon-used block. As a result, the corresponding block is collected as thenon-used block. If the value of the valid page counter of the acquiredcompaction object block becomes 0 (Yes in step S55), the block useinformation control unit 226 registers the corresponding block as thenon-used block in the block use information stored by the block useinformation storage unit 228 and collects the corresponding block as thenon-used block. When the corresponding block is collected as thenon-used block, the compaction unit 270 notifies the log storage unit284 of update information of the updated block use information. In stepS57, the compaction unit 270 requests the conversion table control unit221 to cause a corresponding valid page flag of the physical addressarea that the acquired compaction log-structured pointer corresponds(copy destination page) to become ON. In step S58, the compaction unit270 requests the conversion table control unit 221 to increment a validpage counter of a block that the acquired compaction log-structuredpointer corresponds. In step S59, the compaction unit 270 requests theconversion table control unit 221 to update an entry of the forwardlookup table indicated by the corresponding backward lookup logicaladdress of the physical address area that the acquired compaction objectblock number and valid page flag information correspond (copy originpage) to indicate information of the physical address area that thecompaction log-structured pointer corresponds (copy destination page).The conversion table control unit 221 updates the conversion table thatis stored by the conversion table storage unit 223, according to aninstruction. The compaction unit 270 notifies the log storage unit 284of update information of the updated conversion table.

In step S60, the compaction unit 270 requests the conversion tablecontrol unit 221 to execute an exclusive control end process (lockreleasing process) of the conversion table. The conversion table controlunit 221 executes an exclusive control end process (lock releasingprocess) of the conversion table.

In step S61, the compaction unit 270 requests the compactionlog-structured pointer control unit 242 to update the compactionlog-structured pointer to indicate a next page. The compactionlog-structured pointer control unit 242 updates the compactionlog-structured pointer to indicate a next page. The compaction unit 270notifies the log storage unit 284 of update information of the updatedcompaction log-structured pointer.

In step S62, the compaction unit 270 inquires the compactionlog-structured pointer control unit 242 of whether the updatedcompaction log-structured pointer is over the final page of the block.The compaction log-structured pointer control unit 242 investigateswhether the updated compaction log-structured pointer is over the finalpage of the block and provides the investigation result. If thecompaction unit 270 receives the reply indicating that the updatedcompaction log-structured pointer is over the final page of the block,the process proceeds to step S63. Otherwise, the process proceeds tostep S64.

In step S63, the compaction unit 270 requests the block use informationcontrol unit 226 to execute an allocating process of a non-used block.As a result, the block use information is updated. The block useinformation control unit 226 selects the non-used block from the blockuse information stored by the block use information storage unit 228,allocates the non-used block, and updates the block use information. Thecompaction unit 270 requests the compaction log-structured pointercontrol unit 242 to update the compaction log-structured pointer toindicate a page of a head of a newly allocated block. The compactionlog-structured pointer control unit 242 updates the compactionlog-structured pointer stored by the compaction log-structured pointerstorage unit 240 to indicate a page of a head of a newly allocatedblock. The compaction unit 270 notifies the log storage unit 284 of theupdate information of the updated compaction log-structured pointer andthe update information of the updated block use information.

In step S64, the compaction unit 270 requests the log storage unit 284to commit the update information notified to the log storage unit 284.The log storage unit 284 receives a commitment notification from thecompaction unit 270 and requests the semiconductor storage mediumcontrol unit 203 to store the temporarily stored update information. Thesemiconductor storage medium control unit 203 records the temporarilystored update information as a log. If a physical address of thesemiconductor storage medium 205 where the log is recorded cannot bepreviously recognized, the management information cannot be restoredwhen power is supplied to the data storage device 200. For this reason,the physical address of the semiconductor storage medium 205 where thelog is recorded is made to indicate a predetermined area of thesemiconductor storage medium 205 or an area that can be traced frominformation recorded in the predetermined area of the semiconductorstorage medium 205.

In step S65, the process is repeated from step S45, as needed.

Next, a sequence of a snapshot recording process that is executed by thedata storage device 200 will be described with reference to FIG. 16.FIG. 16 is a flowchart showing an example of a flow of sequence of thesnapshot recording process executed by the data storage device 200. Thedata storage device 200 executes the snapshot storage process atpredetermined timing or arbitrary timing.

In step S71, the snapshot storage unit 282 requests the log storage unit284 to store a log of information indicating a snapshot record start.Thereby, an order relationship of recording times of the snapshot andthe log can be recognized. The log storage unit 284 requests thesemiconductor storage medium control unit 203 to store the informationindicating the snapshot record start. The semiconductor storage mediumcontrol unit 203 records the information indicating the snapshot recordstart as the log. If a physical address of the semiconductor storagemedium 205 where the log is recorded cannot be previously recognized,the management information cannot be restored when power is supplied tothe data storage device 200. For this reason, the physical address ofthe semiconductor storage medium 205 where the log is recorded is madeto indicate a predetermined area of the semiconductor storage medium 205or an area that can be traced from information recorded in thepredetermined area of the semiconductor storage medium 205.

In step S72, the snapshot storage unit 282 requests the conversion tablecontrol unit 221 to extract the conversion table, and acquires theconversion table. The snapshot storage unit 282 requests the host writelog-structured pointer control unit 232 to extract the host writelog-structured pointer, and acquires the host write log-structuredpointer. The snapshot storage unit 282 requests the compactionlog-structured pointer control unit 242 to extract the compactionlog-structured pointer, and acquires the compaction log-structuredpointer. The snapshot storage unit 282 requests the block useinformation control unit 226 to extract the block use information, andacquires the block use information. The conversion table control unit221 extracts the conversion table that is stored by the conversion tablestorage unit 223 and provides the conversion table. The host writelog-structured pointer control unit 232 extracts the host writelog-structured pointer that is stored by the host write log-structuredpointer storage unit 230 and provides the host write log-structuredpointer. The compaction log-structured pointer control unit 242 extractsthe compaction log-structured pointer that is stored by the compactionlog-structured pointer storage unit 240 and provides the compactionlog-structured pointer. The block use information control unit 226extracts the block use information that is stored by the block useinformation storage unit 228 and provides the block use information.

In step S73, the snapshot storage unit 282 requests the semiconductorstorage medium control unit 203 to store the acquired conversion table,the acquired host write log-structured pointer, the acquired compactionlog-structured pointer, and the acquired block use information, andrecords the snapshot. The semiconductor storage medium control unit 203records the acquired conversion table, the acquired host writelog-structured pointer, the acquired compaction log-structured pointer,and the acquired block use information as the snapshot. If a physicaladdress of the semiconductor storage medium 205 where the snapshot orthe log is recorded cannot be previously recognized, the managementinformation cannot be restored when power is supplied to the datastorage device 200. For this reason, the physical address of thesemiconductor storage medium 205 where the snapshot or the log isrecorded is made to indicate a predetermined area of the semiconductorstorage medium 205 or an area that can be traced from informationrecorded in the predetermined area of the semiconductor storage medium205.

In step S74, the snapshot storage unit 282 requests the log storage unit284 to store a log of information indicating a snapshot record end.Thereby, an order relationship of record times of the snapshot and thelog can be recognized. The log storage unit 284 requests thesemiconductor storage medium control unit 203 to store the informationindicating the snapshot record end. The semiconductor storage mediumcontrol unit 203 records the information indicating the snapshot recordend as the log. If a physical address of the semiconductor storagemedium 205 where the log is recorded cannot be previously recognized,the management information cannot be restored when power is supplied tothe data storage device 200. For this reason, the physical address ofthe semiconductor storage medium 205 where the log is recorded isrecorded in a predetermined area of the semiconductor storage medium 205or an area that can be traced from information recorded in thepredetermined area of the semiconductor storage medium 205. The logsthat the log storage unit 284 stores through the semiconductor storagemedium control unit 203 are arranged in time series in reception orderof log commitment process requests by the log storage unit 284, as shownin FIG. 12. In this case, since logs before the snapshot record start(logs 1 and 2 in the example shown in FIG. 12) and the previouslyrecorded snapshot become unnecessary in a management informationrestoring process, the log storage unit 284 frees the logs before thesnapshot record start and the previously recorded snapshot as a new datastorage area.

Next, a sequence of a management information restoring process that isexecuted by the data storage device 200 will be descried with referenceto FIG. 17. FIG. 17 is a flowchart showing an example of a flow of thesequence of the management information restoring process executed by thedata storage device 200. The data storage device 200 restores themanagement information when power is supplied to the data storage device200. The data storage device 200 may restore the management informationat timing when the management information needs to be restored, even inthe cases other than when the power is supplied to the data storagedevice 200. For example, when it is detected that data of the managementinformation stored in the DRAM 54 corrupts, the data storage device 200may execute the management information restoring process.

In step S81, the management information restoring unit 290 requests thesnapshot restoring unit 292 to restore a newest snapshot. If thesnapshot restoring unit 292 receives a restoration request of the newestsnapshot from the management information restoring unit 290, thesnapshot restoring unit 292 issues an extraction request of the newestsnapshot to the semiconductor storage medium control unit 203. Thesemiconductor storage medium control unit 203 reads the requested datafrom the semiconductor storage medium 205 and provides the read data.The snapshot restoring unit 292 receives the newest snapshot. Thesnapshot restoring unit 292 extracts the conversion table from thereceived snapshot and requests the conversion table control unit 221 tostore the extracted conversion table. The conversion table control unit221 stores the extracted conversion table in the conversion tablestorage unit 223. The snapshot restoring unit 292 extracts the hostwrite log-structured pointer from the received snapshot and requests thehost write log-structured pointer control unit 232 to store theextracted host write log-structured pointer. The host writelog-structured pointer control unit 232 stores the extracted host writelog-structured pointer in the host write log-structured pointer storageunit 230. The snapshot restoring unit 292 extracts the compactionlog-structured pointer from the received snapshot and requests thecompaction log-structured pointer control unit 242 to store theextracted compaction log-structured pointer. The compactionlog-structured pointer control unit 242 stores the extracted compactionlog-structured pointer in the compaction log-structured pointer storageunit 240. The snapshot restoring unit 292 extracts the block useinformation from the received snapshot and requests the block useinformation control unit 226 to store the extracted block useinformation. The block use information control unit 226 stores theextracted block use information in the block use information storageunit 228.

In steps S82 to S84, the management information restoring unit 290requests the log restoring unit 294 to restore management informationfrom a log stored after storage of the newest snapshot. If the logrestoring unit 294 receives the restoration request of the managementinformation from the log stored after storage of the newest snapshotfrom the management information restoring unit 290, the log restoringunit 294 issues an extraction request of the log stored after storage ofthe newest snapshot to the semiconductor storage medium control unit203. The semiconductor storage medium control unit 203 reads therequested data from the semiconductor storage medium 205 and providesthe read data. The log restoring unit 294 receives the log stored afterstorage of the newest snapshot. The log restoring unit 294 extracts thelogs from the received logs in record order, and requests the conversiontable control unit 221, the host write log-structured pointer controlunit 232, the compaction log-structured pointer control unit 242 or theblock use information control unit 226 to reflect update information ofa variety of information recorded in the logs. The conversion tablecontrol unit 221, the host write log-structured pointer control unit232, the compaction log-structured pointer control unit 242 or the blockuse information control unit 226 reflects update information of avariety of information recorded in the logs on the conversion tablestored by the conversion table storage unit 223, the host writelog-structured pointer stored by the host write log-structured pointerstorage unit 230, the compaction log-structured pointer stored by thecompaction log-structured pointer storage unit 240 or the block useinformation stored by the block use information storage unit 228.

Next, an advantageous effect of the data storage device 200 according tothe second embodiment will be described.

In the compaction process, as the compaction process result, the blockthat becomes the compaction origin is collected as the non-used block.Accordingly, it is preferable that the number of pages that are copiedby the compaction is small. For this reason, when the compaction objectblock is detected, the block where the number of valid pages is as smallas possible is preferably selected. However, in order to improveefficiency, the number of valid pages of the block that is detected asthe compaction object block needs to be decreased using the addresslocality.

In an access pattern with respect to the data storage device, addresslocality generally exists. If the address locality exists, data wherethe update frequency is high is easily invalidated by new write, anddata where the update frequency is low is rarely invalidated by newwrite. For this reason, data where write is requested from the hostdevice is data having the high update frequency and compacted data isdata that is not updated until the block is compacted. Therefore, thecompacted data is data having the low update frequency.

In the data storage device 200 according to the second embodiment, sincethe configuration where the host write log-structured pointer and thecompaction log-structured pointer are individually provided is used, thedata having the high update frequency and the data having the low updatefrequency can be individually collected. If the data that has the highupdate frequency and is easily invalidated is collected, an expectationvalue of the number of valid pages of the corresponding block can bedecreased. Since the total number of valid pages in the data storagedevice 200 according to the second embodiment is constant, if the datathat has the low update frequency and is rarely invalidated iscollected, an expectation value of the number of valid pages of thecorresponding block increases. As a result, an expectation value of thenumber of valid pages of other block can be decreased.

Meanwhile, at the time of the random write where the address localitydoes not exist, even when the configuration where the host writelog-structured pointer and the compaction log-structured pointer areindividually provided is used or not used, an expectation value of thenumber of valid pages of the block that is detected as the compactionobject block is the same. For this reason, as in the second embodiment,even though the configuration where the host write log-structuredpointer and the compaction log-structured pointer are individuallyprovided is used, random write performance is not deteriorated.

As described above, in the second embodiment, an expectation value ofthe number of valid pages of a block to be compacted can be decreased byusing the address locality of the access pattern. As a result, ascompared with the case in which the configuration where the host writelog-structured pointer and the compaction log-structured pointer areindividually provided is not used, the size of the data that is actuallywritten and read in the data storage device can be made to be smallerthan the size of the data where write is requested from the host device.Therefore, high write performance and the long design lifespan of thedata storage device can be obtained.

In a normal state, the compaction is always executed. Accordingly, whenthe configuration where the host write log-structured pointer and thecompaction log-structured pointer are individually provided is not used,data where write is requested from the host device is written in a newwrite area that is generated as the compaction process execution result.At this time, if the (continuous) compaction write is not completed, thedata where write is requested from the host device is not written. Forthis reason, the write request from the host device is hindered by the(continuous) compaction write, and stable write performance cannot beprovided to the host device.

Conversely, in the second embodiment, the configuration where the hostwrite log-structured pointer and the compaction log-structured pointerare individually provided is used, and the host write process and thecompaction process are independently executed. Further, in thesemiconductor storage medium control unit 203, the process of the writerequest or the read request from the write instructing unit 250 to thesemiconductor storage medium 205 and the process of the write request orthe read request from the compaction unit 270 to the semiconductorstorage medium 205 can be switched as needed. Therefore, according tothe second embodiment, the host write and the compaction write can beswitched in a page unit as needed, and the write request from the hostdevice can be suppressed from being hindered by the compaction write. Asa result, stable write performance can be provided to the host device.

As in the second embodiment, if the configuration where the host writelog-structured pointer and the compaction log-structured pointer areindividually provided is used, the data that is recorded in the datastorage device 200 is easily arranged in logical address order by theoperation from the host device. Specifically, a full-scale sequentialwrite request of the logical address area that is provided by the datastorage device 200 is issued from the host device, and the data that isrecorded in the data storage device can be arranged in logical addressorder. Hereinafter, this configuration will be described with referenceto FIG. 18.

If the full-scale sequential write request of the logical address areathat is provided by the data storage device 200 is issued from the hostdevice, in the logical address where data is written during theexecution of the full-scale sequential write, data is not written againduring the execution of the full-scale sequential write. Now a block isconsidered, which has been a log-structured block for the host write andfor which add is completed after a point of time when the execution ofthe full-scale sequential write starts. The block is now managed as aused block. A page of such block is not invalidated. That is, the block,which has been the log-structured block for the host write, for whichadd is completed after a point of time when the execution of thefull-scale sequential write starts, and which is managed as the usedblock, is not selected as the compaction object block.

Meanwhile, a valid page of a block, which is already managed as a usedblock at a point of time when the full-scale sequential write starts, isdata of a logical address that is not yet written by the full-scalesequential write. Also, a valid page of a block, which has been anlog-structured block for the compaction, for which add is completedafter a point of time when the execution of the full-scale sequentialwrite starts, and which is managed as a used block, is data of a logicaladdress that is not yet written by the full-scale sequential write.

Accordingly, the pages are invalidated by the full-scale sequentialwrite in the future. As described above, the valid page of the block,which is already managed as a used block at a point of time when thefull-scale sequential write starts, and the valid page of the block,which has been the log-structured block for the compaction and for whichadd is completed after a point of time when the execution of thefull-scale sequential write starts to be managed as a used block, isinvalidated one after another. What is selected as the compaction objectblock is the block, which is already managed as a used block at a pointof time when the full-scale sequential write starts, or the block, whichhas been the log-structured block for the compaction and for which addis completed after a point of time when the execution of the full-scalesequential write starts to be managed as a used block.

If the full-scale sequential write is completed, the data that isrecorded in the data storage device 200 is arranged in logical addressorder. In contrast, if the configuration where the host writelog-structured pointer and the compaction log-structured pointer areindividually provided is not used, the compacted data which indicates aninconsistent value on the logical addresses and data which indicates aconsistent value on the logical addresses and in which write isrequested from the host device are always mixed in one block. Therefore,it is difficult to perfectly arrange data written in logical addressorder.

As described above, in a state where the data written in logical addressorder is perfectly arranged, and a sequential write request istransmitted from the host device and one block is used in write of thedata according to the write request, data that is continuous on thephysical addresses is invalidated by one block. Accordingly, if thesequential write request is issued from the host device after theprocess of arranging the data in logical address order, a copy processbased on the compaction does not need to be executed.

In the log-structured method, since the block of the compactiondestination needs to be previously secured, the data storage device 200uses the capacity, which is obtained by subtracting the margin capacityof the predetermined capacity from the total capacity of the storagemedium mounted in the data storage device 200, as the declared capacityprovided to the host device. In a state where the data written inlogical address order is perfectly arranged, all of the blockscorresponding to the declared capacity are filled with the valid pages,and all of the blocks corresponding to the margin capacity become empty.

For this reason, even when random write request is issued from the hostdevice after the process of arranging the data in logical address order,the copy process based on the compaction is not generated until thewrite data amount becomes at least the write data amount correspondingto the margin capacity.

Meanwhile, if the copy process based on the compaction is executed,write performance of data where write is requested from the host deviceis more deteriorated than data write performance with respect to thestorage medium. Since the copy process based on the compaction isexecuted in a normal state, when the state becomes the normal state,write performance of data where write is requested from the host deviceis more deteriorated than data write performance with respect to thestorage medium. As described above, the copy process based on thecompaction is not generated until the write data amount becomes at leastthe write data amount corresponding to the margin capacity after theprocess of arranging the data in logical address order. For this reason,the write performance of the data where write is requested from the hostdevice becomes the data write performance with respect to the storagemedium, until the write data amount becomes at least the write dataamount corresponding to the margin capacity.

Accordingly, the configuration where the host write log-structuredpointer and the compaction log-structured pointer are individuallyprovided is used, and a state in which the write performance of the datawhere write is requested from the host device becomes the data writeperformance with respect to the storage medium can be easily achieved.

In the above description, the process of arranging the data in logicaladdress order is realized by issuing the full-scale sequential writerequest of the logical address area provided by the data storage devicefrom the host device. However, a mechanism that executes the process ofarranging the data in logical address order may be incorporated in thedata storage device.

Third Embodiment

As described above, in the data storage device using the storage mediumhaving constraints (e.g., data can be sequentially written in a pageunit with respect to pages of the data erased block where data is notyet written but overwrite of data is disabled with respect to pageswhere data is already written), the log that corresponds to the updateinformation of the management information also needs to be written in apage unit.

Also in the second embodiment, the storing and restoring processes ofthe management information are enabled. However, when the datamanagement unit is set to the page size as in the second embodiment, themanagement information is updated whenever write is requested from thehost device or whenever data corresponding to one page is written by thecompaction write. For this reason, the log needs to be written in onepage, whenever write is requested from the host device or whenever datacorresponding to one page is written by the compaction write. This meansthat only half the write performance of the data with respect to thestorage medium is realized and that the design lifespan of the datastorage device calculated from the lifespan of the storage mediumbecomes ½.

Accordingly, in the third embodiment, an example in which a log recordcount is decreased will be described. In the description below, thedifference between the second embodiment and the third embodiment ismainly described, and the components that have the same functions asthose of the 10 second embodiment are denoted by the same referencenumerals as those of the second embodiment and the description thereofis not repeated.

First, the configuration of a data storage device according to the thirdembodiment will be described.

FIG. 19 is a block diagram showing an example of the detailed functionconfiguration of a data storage device 300 according to the thirdembodiment. In the data storage device 300 according to the thirdembodiment, a conversion table storage unit 323, a block use informationcontrol unit 326, a write instructing unit 350, a compaction unit 370,and a log restoring unit 394 are different from those of the datastorage device 200 according to the second embodiment. Hereinafter, thedifference of the individual units will be described.

The conversion table storage unit 323 stores a conversion table. Theconversion table according to the third embodiment includes a forwardlookup table, a valid page flag, and a valid page counter, but does notinclude a backward lookup table.

FIG. 20 shows an example of the data configuration of the valid pageflag and the valid page counter. As shown in FIG. 20, the valid pageflag and the valid page counter use a block number as an index andinclude the block number, the valid page counter, and the valid pageflag set as an entry. The valid page flag set is arranged in order ofthe pages arranged in the block and can specify the page of the validpage flag. A value of the valid page counter of the same block and thetotal number of true values of the valid page flags are matched witheach other. The block number that becomes the index and the block numberthat becomes the entry of the forward lookup table are assigned with thesame number in the same block. The forward lookup table is the same asthe forward lookup table that is included by the conversion tablestorage unit 223 according to the second embodiment.

As described above, the conversion table storage unit 323 according tothe third embodiment does not include the backward lookup table, incontrast to the conversion table storage unit 223 according to thesecond embodiment. Thereby, in the third embodiment, a memory use amountof management information can be decreased. When the memory use amountof the management information can be decreased, this means that thecapacity to be stored as the snapshot decreases. As a result, a processtime that is needed to store the snapshot can be decreased, the writeamount with respect to the semiconductor storage medium 205 can bedecreased, and the design lifespan of the data storage device 300 can beincreased.

If the block use information control unit 326 receives an allocationrequest of a non-used block from the write instructing unit 350, theblock use information control unit 326 suspends a process of the writeinstructing unit 350, until the allocation request of the non-used blockis fully received from the compaction unit 370. Likewise, if the blockuse information control unit 326 receives an allocation request of anon-used block from the compaction unit 370, the block use informationcontrol unit 326 suspends a process of the compaction unit 370, untilthe allocation request of the non-used block is fully received from thewrite instructing unit 350.

If the block use information control unit 326 fully receives anallocation request of a non-used block from both the write instructingunit 350 and the compaction unit 370, and the write amount from the hostdevice at a corresponding point of time is 1 and the write amount of thecompaction to be processed in the data storage device 300 is N (N is aninteger equal to or more than 0), the block use information control unit326 allocates one non-used block to the write instructing unit 350 andallocates N non-used blocks to the compaction unit 370. The block useinformation control unit 326 can determine a value of N from informationof the number of used blocks included in block use information stored bythe block use information storage unit 228 or information of the numberof non-used blocks. A case is considered where the value of N is set tobe more than the write amount of the compaction to be processed in thedata storage device 300 when the write amount from the host device at acorresponding point of time is 1. When a load of the write request fromthe host device is not large, the compaction process is first executedand the amount of a compaction process to be executed in the future isdecreased. Thus, responsiveness at the time when the load of the writerequest from the host device increases in the future can be improved.

The block use information control unit 326 updates the block useinformation that is stored by the block use information storage unit228, according to the allocated contents. The block use informationcontrol unit 326 restarts the suspended processes of both the writeinstructing unit 350 and the compaction unit 370.

Next, the compaction process and the write process according to the hostwrite request from the host device will be described with reference toFIGS. 21 to 25.

First, as shown in FIG. 21, the block use information control unit 326allocates a block D to the write instructing unit 350 and allocatesblocks A, B, and C to the compaction unit 370. The order of pages wherethe compaction unit 370 writes data by the compaction process becomesorder of the blocks A, B, and C. If the block use information controlunit 326 restarts the suspended processes of both the write instructingunit 350 and the compaction unit 370, as shown in FIG. 22, thecompaction object data and the write object data from the host deviceare added according to the log-structured pointer for the host write andthe log-structured pointer for the compaction. As shown in FIG. 23 or24, even when one of the log-structured pointers arrives at an end ofthe allocated block, the process is suspended until the otherlog-structured pointer arrives at the end of the allocated block, and anew block is not allocated.

As described above, when the write amount from the host device at acorresponding point of time is 1 and the write amount of the compactionto be processed in the data storage device 300 is N (N is an integerequal to or more than 0), the block use information control unit 326allocates one non-used block to the write instructing unit 350 andallocates N non-used blocks to the compaction unit 370. This is tosecure the compaction amount needed at a corresponding point of time andto avoid, as much as possible, the process from being suspended untilthe other log-structured pointer arrives at an end of the allocatedblock, even when one log-structured pointer arrives at the end of theallocated block, as shown in FIG. 23 or 24.

As shown in FIG. 25, if both the log-structured pointers arrive at theend of the allocated block, the block use information control unit 326allocates new blocks to the write instructing unit 350 and thecompaction unit 370 and restarts the suspended processes of the writeinstructing unit 350 and the compaction unit 370, and the state becomesa state shown in FIG. 21. Hereinafter, time needed from allocation ofthe block to allocation of a next block is called a “term”.

In the case where address locality exists in the access pattern from thehost device, when the write amount from the host device at acorresponding point of time is 1, the compaction amount to be processedin the data storage device 300 may significantly decrease. In this case,however, in the rule of the block allocation described above, as shownin FIG. 26, terms where one log-structured block for the compaction isallocated (terms 2 and 6) and terms where the log-structured block forthe compaction is not allocated (terms 1, 3, 4, 5) are appropriatelyswitched.

Referring back to FIG. 19, the block use information control unit 326notifies the log storage unit 284 of block allocation information withrespect to the allocated (N+1) blocks. In the order of the allocationinformation, a block that is allocated to the compaction unit 370 istemporally prior to a block that is allocated to the write instructingunit 350. When plural blocks are allocated to the compaction unit 370,the order of the allocation information becomes order of the blocks thatare used by the compaction unit 370. For example, the order of theallocation information in the case where the blocks are allocated asshown in FIGS. 21 to 25 becomes order of the block A, the block B, theblock C, and the block D. The order of the allocation information in thecase where the blocks are allocated as shown in FIG. 26 becomes order ofthe block A in the term 1, the block B and the block C in the term 2,the block D in the term 3, the block E in the term 4, the block F in theterm 5, and the block G and the block H in the term 6. The block useinformation control unit 326 requests the log storage unit 284 to committhe information notified to the log storage unit 284.

The write instructing unit 350 issues an extraction request of storeddata corresponding to the management size to the buffer control unit207, transmits the extracted data and the physical address areainformation that the acquired host write log-structured pointercorresponds to the semiconductor storage medium control unit 203, andrequests the semiconductor storage medium control unit 203 to write theextracted data in the physical address area that the acquired host writelog-structured pointer corresponds. When the acquired host writelog-structured pointer indicates a head page of the block, the writeinstructing unit 350 requests the semiconductor storage medium controlunit 203 to execute a block erasing process, before requesting thesemiconductor storage medium control unit 203 to write data. However,execution timing of the block erasing process is not limited thereto.For example, the execution timing may be timing when a block for hostwrite is newly allocated, timing when a block is collected as a non-usedblock or arbitrary timing during a period of time until the writeinstructing unit 350 requests the semiconductor storage medium controlunit 203 to write data, after the block is collected as the non-usedblock.

In the page of the semiconductor storage medium 205, a redundant area isgenerally provided in addition to an area to record user data. Theredundant area is used to record data of an error correcting code withrespect to the user data, for example. In the third embodiment where thelog record count is decreased, the data of the error correcting code andthe backward lookup logical address of the corresponding page arerecorded in the redundant area to decrease the log record count. Thatis, as shown in FIG. 27, with respect to the data that is recorded inthe page, the user data is recorded in the area to record the user dataand the backward lookup logical address of the corresponding page andthe data of the error correcting code are recorded in the redundantarea. The recorded backward lookup logical address is a logical addressof a head of a management size area that includes an area of a writecommand (logical address 0 in the example shown in FIG. 11).

The write instructing unit 350 updates the conversion table to indicatenewly written data, during the exclusive control of the conversiontable. Specifically, the write instructing unit 350 inquires theconversion table control unit 221 of a physical address (pre-updatephysical address) that corresponds to a logical address of the head ofthe management size area including the area of the write command(logical address 0 in the example shown in FIG. 11), before receivingthe write command. The write instructing unit 350 requests theconversion table control unit to cause a valid page flag that theacquired pre-update physical address corresponds to become OFF. Thewrite instructing unit 350 requests the conversion table control unit221 to decrement a valid page counter of a block that the acquiredpre-update physical address corresponds. The write instructing unit 350requests the conversion table control unit 221 to cause a valid pageflag that the acquired host write log-structured pointer corresponds tobecome ON. The write instructing unit 350 requests the conversion tablecontrol unit 221 to increment a valid page counter of a block that theacquired host write log-structured pointer corresponds. The writeinstructing unit 350 requests the conversion table control unit 221 toupdate the logical address of the head of the management size areaincluding the area of the write command (logical address 0 in theexample shown in FIG. 11) of the forward lookup table to indicate theinformation of the physical address area that the host writelog-structured pointer corresponds.

The write instructing unit 350 according to the third embodiment doesnot notify the log storage unit 284 of the update information of theconversion table, in contrast to the write instructing unit 250according to the second embodiment. This is because the updateinformation of the conversion table can be restored on the basis of thebackward lookup logical address recorded in the page, at the time ofrestoring management information to be described below. In the writeinstructing unit 250 according to the second embodiment, the log of theupdate information of the conversion table is recorded whenever the userdata of one page is written. However, in the write instructing unit 350according to the third embodiment, the log of the update informationdoes not need to be recorded whenever the user data of one page iswritten, and the log record count can be greatly decreased.

The write instructing unit 350 requests the host write log-structuredpointer control unit 232 to update the host write log-structured pointerto indicate a next page. The write instructing unit 350 inquires thehost write log-structured pointer control unit 232 of whether theupdated host write log-structured pointer is over the final page of theblock. If the write instructing unit 350 receives a reply indicatingthat the updated host write log-structured pointer is over the finalpage of the block, the write instructing unit 350 notifies the logstorage unit 284 of add completion information of the correspondingblock and requests the log storage unit 284 to commit the notifiedinformation. In order to decrease a restoration processing time to bedescribed below, backward lookup logical addresses of all pages that areadded in a block until add is completed after the block is allocated maybe stored, and the backward lookup logical addresses of the pages thatare added in the corresponding block may be included in the add writeend log of the corresponding block.

If the write instructing unit 350 receives a reply indicating that theupdated host write log-structured pointer is over the final page of theblock, the write instructing unit 350 requests the block use informationcontrol unit 326 to execute an allocating process of a non-used block.As a result, the block use information is updated. The write instructingunit 350 requests the host write log-structured pointer control unit 232to update the host write log-structured pointer to indicate a page of ahead of a newly allocated block.

The write instructing unit 350 according to the third embodiment doesnot notify the log storage unit 284 of the update information of thehost write log-structured pointer, in contrast to the write instructingunit 250 according to the second embodiment. The update information ofthe block use information that is notified by the write instructing unit250 according to the second embodiment is notified by the block useinformation control unit 326 in the third embodiment. This is becausethe host write log-structured pointer can be restored when theconversion table can be restored on the basis of the backward lookuplogical address recorded in the page, at the time of restoringmanagement information to be described below. In the write instructingunit 250 according to the second embodiment, the log of the updateinformation of the host write log-structured pointer is recordedwhenever the user data of one page is written. However, in the writeinstructing unit 350 according to the third embodiment, the log of theupdate information does not need to be recorded whenever the user dataof one page is written, and the log record count can be greatlydecreased.

The compaction unit 370 inquires the conversion table control unit 221of the block suitable for a compaction object among the acquired blocks,and acquires a block number of the block suitable for the compactionobject and a valid page flag and a valid page counter of thecorresponding block. The block that is suitable for the compactionobject is a block where a value of the valid page counter is smallest.In this case, when the block where the value of the valid page counteris 0 is selected as the compaction object, the compaction unit 370requests the block use information control unit 326 to register thecorresponding block as a non-used block. As a result, the correspondingblock is collected as the non-used block. When the corresponding blockis collected as the non-used block, the compaction unit 370 notifies thelog storage unit 284 of update information of the updated block useinformation. Further, the compaction unit 370 requests the log storageunit 284 to commit the information notified to the log storage unit 284.

The compaction unit 370 issues a read request of a physical address areathat the acquired compaction object block number and valid page flaginformation correspond (copy origin page) to the semiconductor storagemedium control unit 203. If the compaction unit 370 receives the readdata, the compaction unit 370 issues a storage request of the receiveddata to the buffer control unit 207. In the received data, as shown inFIG. 27, the user data is recorded in the area to record the user data,and the backward lookup logical address of the corresponding page andthe data of the error correcting code are recorded in the redundantarea. The compaction unit 370 extracts the backward lookup logicaladdress that is recorded in the redundant area of the read data andtemporarily stores the backward lookup logical address.

The compaction unit 370 issues an extraction request of the stored datato the buffer control unit 207, transmits the extracted data and theinformation of the physical address area that the acquired compactionlog-structured pointer corresponds (copy destination page) to thesemiconductor storage medium control unit 203, and requests thesemiconductor storage medium control unit 203 to write the extracteddata in the physical address area that the acquired compactionlog-structured pointer corresponds (copy destination page). When theacquired compaction log-structured pointer indicates a head page of theblock, the compaction unit 370 requests the semiconductor storage mediumcontrol unit 203 to execute a block erasing process, before requestingthe semiconductor storage medium control unit 203 to write data.However, timing at which the block erasing process is executed is notlimited thereto. For example, the timing may be timing when a block forcompaction is newly allocated, timing when a block is collected as anon-used block or arbitrary timing during a period of time until thecompaction unit 370 requests the semiconductor storage medium controlunit 203 to write data, after the block is collected as the non-usedblock.

Since the data stored in the page is the data stored in the bufferstorage unit 209, as shown in FIG. 27, the user data is recorded in thearea to record the user data, and the backward lookup logical address ofthe corresponding page and the data of the error correcting code arerecorded in the redundant area. The backward lookup table is newlywritten only when the data is written in the page, is not updatedhereinafter, and is referred to only at the time of the compaction.Therefore, the backward lookup table can be simultaneously written whenthe data is written in the page according to the write request from thehost device, and the backward lookup table can be simultaneously readwhen the compacted data is read. As a result, a penalty is notadditionally caused.

The compaction unit 370 updates the conversion table to indicate data ofa compaction destination, during the exclusive control of the conversiontable. However, as described above, when a write process of the samelogical address area as a logical address area that data being copiedcorresponds is completed by the write instructing unit 350 during thecopy process of the data, the compaction unit 370 should not update theconversion table.

Specifically, the compaction unit 370 issues a reference request of theforward lookup table to the conversion table control unit 221 using thetemporarily stored backward lookup logical address information andacquires a physical address that corresponds to the temporarily storedbackward lookup logical address information. The compaction unit 370determines whether the physical address corresponding to the temporarilystored backward lookup logical address information and the physicaladdress area that the acquired compaction object block number and validpage flag information correspond (copy origin page) are matched witheach other. When it is determined that the physical address and thephysical address area are not matched with each other, this means thatthe write process of the same logical address area as the logicaladdress area that the data being copied corresponds is completed by thewrite instructing unit 350 during the copy process of the data. For thisreason, the compaction unit 370 ends the process during the exclusivecontrol of the conversion table and does not update the conversiontable. When it is determined that the physical address and the physicaladdress area are matched with each other, this means that the writeprocess of the same logical address area as the logical address areathat the data being copied corresponds is not executed by the writeinstructing unit 350 or executed but not completed during the copyprocess of the data. For this reason, the compaction unit 370 updatesthe conversion table.

Specifically, the compaction unit 370 requests the conversion tablecontrol unit 221 to cause a valid page flag of a physical address areathat the acquired compaction object block number and valid page flaginformation correspond (copy origin page) to become OFF. The compactionunit 370 requests the conversion table control unit 221 to decrement avalid page counter of a block that corresponds to the acquiredcompaction object block number. The compaction unit 370 requests theconversion table control unit 221 to cause a corresponding valid pageflag of the physical address area that the acquired compactionlog-structured pointer corresponds (copy destination page) to become ON.The compaction unit 370 requests the conversion table control unit 221to increment a valid page counter of a block that the acquiredcompaction log-structured pointer corresponds. The compaction unit 370requests the conversion table control unit 221 to update an entry of theforward lookup table indicated by the corresponding backward lookuplogical address of the physical address area that the acquiredcompaction object block number and valid page flag informationcorrespond (copy origin page) to indicate information of the physicaladdress area that the compaction log-structured pointer corresponds(copy destination page).

The compaction unit 370 according to the third embodiment does notnotify the log storage unit 284 of the update information of theconversion table, in contrast to the compaction unit 270 according tothe second embodiment. This is because the update information of theconversion table can be restored on the basis of the backward lookuplogical address recorded in the page, at the time of restoringmanagement information to be described below. In the compaction unit 270according to the second embodiment, the log of the update information ofthe conversion table is recorded whenever the user data of one page iswritten. However, in the compaction unit 370 according to the thirdembodiment, the log of the update information does not need to berecorded whenever the user data of one page is written, and the logrecord count can be greatly decreased.

The compaction unit 370 requests the block use information control unit326 to register the corresponding block as a non-used block, if thevalue of the valid page counter of the acquired compaction object blockbecomes 0. As a result, the corresponding block is collected as thenon-used block. When the corresponding block is collected as thenon-used block, the compaction unit 370 notifies the log storage unit284 of update information of the updated block use information andrequests the log storage unit 284 to commit the information notified tothe log storage unit 284.

The compaction unit 370 requests the compaction log-structured pointercontrol unit 242 to update the compaction log-structured pointer toindicate a next page. The compaction unit 370 inquires the compactionlog-structured pointer control unit 242 of whether the updatedcompaction log-structured pointer is over the final page of the block.If the compaction unit 370 receives a reply indicating that the updatedcompaction log-structured pointer is over the final page of the block,the compaction unit 370 notifies the log storage unit 284 of the addcompletion information of the corresponding block and requests the logstorage unit 284 to commit the information notified to the log storageunit 284. In order to decrease a restoration processing time to bedescribed below, backward lookup logical addresses of all pages that areadded in a block until add write is completed after the block isallocated may be stored, and the backward lookup logical addresses ofthe pages that are added in the corresponding block may be included inthe add write end log of the corresponding block.

If the compaction unit 370 receives a reply indicating that the updatedcompaction log-structured pointer is over the final page of the block,the compaction unit 370 requests the compaction log-structured pointercontrol unit 242 to update the compaction log-structured pointer toindicate a page of a head of a next block allocated from the block useinformation control unit 326.

When the compaction unit 370 receives a reply indicating that theupdated compaction log-structured pointer is over the final page of theblock and uses all of the blocks allocated from the block useinformation control unit 326, the compaction unit 370 requests the blockuse information control unit 326 to execute an allocating process of anon-used block. As a result, the block use information is updated. Thecompaction unit 370 requests the compaction log-structured pointercontrol unit 242 to update the compaction log-structured pointer toindicate a page of a head of a newly allocated block.

The compaction unit 370 according to the third embodiment does notnotify the log storage unit 284 of the update information of thecompaction log-structured pointer, in contrast to the compaction unit270 according to the second embodiment. The update information of theblock use information that is notified by the compaction unit 270 isnotified by the block use information control unit 326 in the thirdembodiment. This is because the compaction log-structured pointer can berestored when the update information of the conversion table can berestored on the basis of the backward lookup logical address recorded inthe page, at the time of restoring management information to bedescribed below. In the compaction unit 270 according to the secondembodiment, the log of the update information of the compactionlog-structured pointer is recorded whenever the user data of one page iswritten. However, in the compaction unit 370 according to the thirdembodiment, the log of the update information does not need to berecorded whenever the user data of one page is written, and the logrecord count can be greatly decreased.

If the log restoring unit 394 receives a restoration request of themanagement information from the log stored after storage of the newestsnapshot from the management information restoring unit 290, the logrestoring unit 394 issues an extraction request of the log stored afterstorage of the newest snapshot to the semiconductor storage mediumcontrol unit 203, and receives the log stored after storage of thenewest snapshot.

In the log, any of the information of the newly allocated block, the addcompletion information of the block, and the information of the blockcollected as the non-used block is recorded. In this case, in theinformation of the newly allocated block, information of one or moreblocks for the compaction add is arranged in order of the blocks used bythe compaction unit 370, and the information of the block for the hostadd used by the write instructing unit 350 follows. The term does notproceed to a next term as long as the add of all of the blocks allocatedin the certain term is not completed. Thus, by tracing the log in recordorder, it is confirmed that a log of block allocation of a next term isrecorded in a state where add completion information of all of theblocks allocated in the certain term is recorded, and validity of thelog is investigated.

The log restoring unit 394 extracts block numbers in order, with respectto the information of the allocated blocks. The log restoring unit 394issues a read request of a page to the semiconductor storage mediumcontrol unit 203, sequentially from a page of a head, with respect tothe blocks of the extracted block numbers. The log restoring unit 394receives the data of the read page from the semiconductor storage mediumcontrol unit 203 and extracts the backward lookup logical addressinformation from the received data.

The log restoring unit 394 causes the entry of the extracted backwardlookup logical address of the conversion table to indicate the readpage, on the basis of the extracted backward lookup logical addressinformation. Specifically, the log restoring unit 394 inquires theconversion table control unit 221 of a physical address (pre-updatephysical address) that corresponds to the extracted backward lookuplogical address, before reading the page. The log restoring unit 394requests the conversion table control unit 221 to cause a valid pageflag that the acquired pre-update physical address corresponds to becomeOFF. The log restoring unit 394 requests the conversion table controlunit 221 to decrement a valid page counter of a block that the acquiredpre-update physical address corresponds. The log restoring unit 394requests the conversion table control unit 221 to cause a valid pageflag that the read page corresponds to become ON. The log restoring unit394 requests the conversion table control unit 221 to increment a validpage counter of a block that the read page corresponds. The logrestoring unit 394 requests the conversion table control unit 221 toupdate the extracted backward lookup logical address of the forwardlookup table to indicate the physical address area information that theread page corresponds.

With respect to the block where the add is not completed, a non-recordedpage is read during the above process. A case is considered where allbits of the data of the erased page including the data of the redundantarea shown in FIG. 27 have a value of 1, for example. If it isdetermined whether the values of all of the bits become 1, it can berecognized that the read page is a non-recorded page, for example. Atthis time, the log restoring unit 394 requests the host writelog-structured pointer control unit 232 to update the host writelog-structured pointer to indicate the non-recorded page, when the blockwhere the add is not completed is the block allocated for the host add.Meanwhile, the log restoring unit 394 requests the compactionlog-structured pointer control unit 242 to update the compactionlog-structured pointer, when the block where the add is not completed isthe block allocated for the compaction add.

In this case, in the same term, even when the host write and thecompaction are generated in the same logical address, the changeaccording to the compaction write is first reflected on the managementinformation and the change according to the host write is reflected.Finally, a series of management information indicates the page subjectedto the host write. Thereby, consistency of the management information issecured.

When the backward lookup logical addresses of all of the pages added inthe block until the add is completed after the block is allocated arestored and the backward lookup logical addresses of the pages added inthe corresponding block are included in the add completion log of thecorresponding block, the backward lookup logical addresses of all of thepages added in the corresponding block can be recognized by only viewingthe add completion log. Thereby, the amount of the read process from thesemiconductor storage medium 205 can be greatly decreased, and the pagesmay be sequentially read from the head, with respect to only the blockwhere the final add is performed.

If the information of the block collected as the non-used block isrecorded in the log, the log restoring unit 394 requests the block useinformation control unit 326 to change the use state of thecorresponding block to the non-used state.

Next, the operation of the data storage device according to the thirdembodiment will be described. Since the read process and the snapshotrecording process are the same as those of the second embodiment, thedescription thereof will not be repeated.

First, a sequence of a write process that is executed by the datastorage device 300 according to a write command from the host devicewill be described with reference to FIG. 28.

FIG. 28 is a flowchart showing an example of a flow of a sequence of thewrite process executed by the data storage device 300.

Since processes of steps S101 to S107 are the same as those of steps S1to S7 of FIG. 13, the description will not be repeated.

Since a process of step S108 is also the same as that of step S8 of FIG.13, the description will not be repeated. However, as shown in FIG. 27,in the page, the user data is recorded in the area to record the userdata and the backward lookup logical address of the corresponding pageand the data of the error correcting code are recorded in the redundantarea. For this reason, in the third embodiment, as shown in step S9 ofFIG. 13, the backward lookup logical address of the written page doesnot need to be separately registered, and the backward lookup logicaladdress does not need to be recorded in the log.

Since processes of steps S110 to S115 are the same as those of steps S10to S15 of FIG. 13, the description will not be repeated.

Since a process of step S116 is also the same as that of step S16 ofFIG. 13, the description will not be repeated.

However, in step S116, the update information of the conversion table isnot notified to the log storage unit 284. This is because the updateinformation of the conversion table can be restored on the basis of thebackward lookup logical address recorded in the page, at the time ofrestoring management information to be described below. Thereby, insteps S12 to 316 of FIG. 13, the log of the update information of theconversion table is recorded whenever the user data of one page iswritten. However, in steps S112 to S116 of FIG. 28, the log of theupdate information does not need to be recorded whenever the user dataof one page is written, and the log record count can be greatlydecreased.

Since a process of step S117 is the same as that of step S17 of FIG. 13,the description will not be repeated.

Since a process of step S118 is almost the same as that of step S18 ofFIG. 13, the description will not be repeated. However, in step S118,the update information of the updated host write log-structured pointeris not notified to the log storage unit 284. This is because the updateinformation of the host write log-structured pointer can be restored, atthe time of restoring management information to be described below.Thereby, in steps S18 of FIG. 13, the log of the update information ofthe host write log-structured pointer is recorded whenever the user dataof one page is written.

However, in step S118 of FIG. 28, the log of the update information doesnot need to be recorded whenever the user data of one page is written,and the log record count can be greatly decreased.

Since a process of step S119 is the same as that of step S19 of FIG. 13,the description will not be repeated.

In step S119.5, the write instructing unit 350 notifies the log storageunit 284 of add completion information of the corresponding block andrequests the log storage unit 284 to commit the notified information. Inorder to decrease a restoration processing time to be described below,backward lookup logical addresses of all pages that are added in a blockuntil add is completed after the block is allocated may be stored, andthe backward lookup logical addresses of the pages that are added in thecorresponding block may be included in the add end log of thecorresponding block. The log storage unit 284 receives the commitmentnotification from the write instructing unit 350 and requests thesemiconductor storage medium control unit 203 to store the temporarilystored update information. The semiconductor storage medium control unit203 records the temporarily stored update information as a log. If thephysical address of the semiconductor storage medium 205 where the logis recorded cannot be previously recognized, the management informationcannot be restored when power is supplied to the data storage device300. For this reason, the physical address of the semiconductor storagemedium 205 where the log is recorded is made to indicate a predeterminedarea of the semiconductor storage medium 205 or an area that can betraced from information recorded in the predetermined area of thesemiconductor storage medium 205. The write instructing unit 350requests the block use information control unit 326 to execute anallocating process of a non-used block. If the block use informationcontrol unit 326 receives an allocation request of a non-used block fromthe write instructing unit 350, the block use information control unit326 suspends a process of the write instructing unit 350, until theallocation request of the non-used block is received from the compactionunit 370.

In step S120, if the block use information control unit 326 fullyreceives an allocation request of a non-used block from both the writeinstructing unit 350 and the compaction unit 370, and the write amountfrom the host device at a corresponding point of time is 1 and the writeamount of the compaction to be processed in the data storage device 300is N (N is an integer equal to or more than 0), the block useinformation control unit 326 allocates one non-used block to the writeinstructing unit 350 and allocates N non-used blocks to the compactionunit 370. The block use information control unit 326 can determine avalue of N from information of the number of used blocks included inblock use information stored by the block use information storage unit228 or information of the number of non-used blocks. If the value of Nis set to be more than the write amount of the compaction to beprocessed in the data storage device 300 when the write amount from thehost device at a corresponding point of time is 1, when a load of thewrite request from the host device is not large, the block useinformation control unit 326 first executes the compaction process anddecreases the amount of a compaction process to be executed in thefuture, thereby improving responsiveness of when the load of the writerequest from the host device increases in the future. The block useinformation control unit 326 updates the block use information that isstored by the block use information storage unit 228, according to theallocated contents. The block use information control unit 326 restartsthe suspended process of the write instructing unit 350. The block useinformation control unit 326 notifies the log storage unit 284 of blockallocation information with respect to the allocated (N+1) blocks. Inthe order of the allocation information, a block that is allocated tothe compaction unit 370 is temporally prior to a block that is allocatedto the write instructing unit 350. When plural blocks are allocated tothe compaction unit 370, the order of the allocation information becomesorder of the blocks that are used by the compaction unit 370. Forexample, the order of the allocation information in the case where theblocks are allocated as shown in FIGS. 21 to 25 becomes order of theblock A, the block B, the block C, and the block D. The order of theallocation information in the case where the blocks are allocated asshown in FIG. 26 becomes order of the block A in the term 1, the block Band the block C in the term 2, the block D in the term 3, the block E inthe term 4, the block F in the term 5, and the block G and the block Hin the term 6. The block use information control unit 326 requests thelog storage unit 284 to commit the information notified to the logstorage unit 284. The log storage unit 284 receives the commitmentnotification from the block use information control unit 326 andrequests the semiconductor storage medium control unit 203 to store thetemporarily stored update information. The semiconductor storage mediumcontrol unit 203 records the temporarily stored update information as alog. If the physical address of the semiconductor storage medium 205where the log is recorded cannot be previously recognized, themanagement information cannot be restored when power is supplied to thedata storage device 300. For this reason, the physical address of thesemiconductor storage medium 205 where the log is recorded is made toindicate a predetermined area of the semiconductor storage medium 205 oran area that can be traced from information recorded in thepredetermined area of the semiconductor storage medium 205. The writeinstructing unit 350 requests the host write log-structured pointercontrol unit 232 to update the host write log-structured pointer toindicate a page of a head of a newly allocated block. The host writelog-structured pointer control unit 232 updates the host writelog-structured pointer stored by the host write log-structured pointerstorage unit 230 to indicate a page of a head of a newly allocatedblock.

As described above, in FIG. 28, the log is recorded by the blockallocation event. However, since the block allocation event is at thesame time as the block allocation process in the compaction process, asshown in step S21 of FIG. 13, the log commitment process cannot beexecuted at the end, so the log needs to be committed on demand.

Since a process of step S122 is the same as that of step S22 of FIG. 13,the description will not be repeated.

Next, a sequence of a compaction process that is executed by the datastorage device 300 will be described with reference to FIG. 29. FIG. 29is a flowchart showing an example of a flow of a sequence of thecompaction process executed by the data storage device 300. The datastorage device 300 executes the compaction process at timing when thecompaction process is needed or arbitrary timing. The timing at whichthe compaction process is needed can be determined by determiningwhether the number of non-used blocks recorded in the block useinformation is less than the predetermined threshold value.

First, since processes of steps S141 and S142 are the same as those ofsteps S41 and S42 of FIG. 15, the description will not be repeated.

Since a process of step S143 is almost the same as that of step S43 ofFIG. 15, the description will not be repeated. However, the followingprocess is executed. The compaction unit 370 requests the log storageunit 284 to commit the updated block use information. The log storageunit 284 receives the commitment notification from the compaction unit370 and requests the semiconductor storage medium control unit 203 tostore the temporarily stored update information. The semiconductorstorage medium control unit 203 records the temporarily stored updateinformation as a log. If the physical address of the semiconductorstorage medium 205 where the log is recorded cannot be previouslyrecognized, the management information cannot be restored when power issupplied to the data storage device 300. For this reason, the physicaladdress of the semiconductor storage medium 205 where the log isrecorded is made to indicate a predetermined area of the semiconductorstorage medium 205 or an area that can be traced from informationrecorded in the predetermined area of the semiconductor storage medium205.

Since processes of steps S144 to S46 are the same as those of steps S44to S46 of FIG. 15, the description will not be repeated. With respect tothe data read in step S146, as shown in FIG. 27, the user data isrecorded in the area to record the user data and the backward lookuplogical address of the corresponding page and the data of the errorcorrecting code are recorded in the redundant area.

In step S147, the compaction unit 370 extracts the backward lookuplogical address that is recorded in the redundant area of the read dataand temporarily stores the backward lookup logical address.

Since a process of step S148 is almost the same as that of step S48 ofFIG. 15, the description will not be repeated. However, as shown in FIG.27, in the page, the user data is recorded in the area to record theuser data and the backward lookup logical address of the correspondingpage and the data of the error correcting code are recorded in theredundant area. For this reason, in the third embodiment, as shown instep S49 of FIG. 15, the backward lookup logical address of the writtenpage does not need to be separately registered, and the backward lookuplogical address does not need to be recorded in the log. As describedabove, the backward lookup table is newly written only when the data iswritten in the page, is not updated hereinafter, and is referred to onlyat the time of the compaction. Therefore, the backward lookup table canbe simultaneously written when the data is written in the page accordingto the write request from the host device, and the backward lookup tablecan be simultaneously read when the data to be compacted is read. As aresult, a penalty is not additionally caused.

Since processes of steps S150 to S158 are almost the same as those ofsteps S50 to S58 of FIG. 15, the description will not be repeated. The“corresponding backward lookup logical address of the physical addressarea that the acquired compaction object block number and valid pageflag information correspond (copy origin page)” in steps S50 to S58 ofFIG. 15 corresponds to the extracted backward lookup logical address insteps S150 to S158 of FIG. 29.

Since a process of step S159 is almost the same as that of step S59 ofFIG. 15, the description will not be repeated. In step S159 of FIG. 29,the update information of the conversion table is not notified to thelog storage unit 284, in contrast to step S59 of FIG. 15. This isbecause the update information of the conversion table can be restoredon the basis of the backward lookup logical address recorded in thepage, at the time of restoring management information to be describedbelow. Thereby, in steps S53 to S59 of FIG. 15, the log of the updateinformation of the conversion table is recorded whenever the user dataof one page is written. However, in steps S153 to S159 of FIG. 29, thelog of the update information does not need to be recorded whenever theuser data of one page is written, and the log record count can begreatly decreased. When the value of the valid page counter of thecompaction object block becomes 0 and the corresponding block iscollected as the non-used block, the compaction unit 370 notifies thelog storage unit 284 of the update information of the updated block useinformation and requests the log storage unit 284 to commit theinformation notified to the log storage unit 284. The log storage unit284 receives the commitment notification from the compaction unit 370and requests the semiconductor storage medium control unit 203 to storethe temporarily stored update information. The semiconductor storagemedium control unit 203 records the temporarily stored updateinformation as a log. If the physical address of the semiconductorstorage medium 205 where the log is recorded cannot be previouslyrecognized, the management information cannot be restored when power issupplied to the data storage device 300. For this reason, the physicaladdress of the semiconductor storage medium 205 where the log isrecorded is made to indicate a predetermined area of the semiconductorstorage medium 205 or an area that can be traced from informationrecorded in the predetermined area of the semiconductor storage medium205.

Since a process of step S160 is the same as that of step S60 of FIG. 15,the description will not be repeated.

Since a process of step S161 is almost the same as that of step S61 ofFIG. 15, the description will not be repeated. In step S161 of FIG. 29,the update information of the updated compaction log-structured pointeris not notified to the log storage unit 284, in contrast to step S61 ofFIG. 15. This is because the update information of the compactionlog-structured pointer can be restored, at the time of restoringmanagement information to be described below. Thereby, in step S61 ofFIG. 15, the log of the update information of the compactionlog-structured pointer is recorded whenever the compaction of one pageis performed. However, in step S161 of FIG. 29, the log of the updateinformation does not need to be recorded whenever the compaction of onepage is performed, and the log record count can be greatly decreased.

Since a process of step S162 is the same as that of step S62 of FIG. 15,the description will not be repeated.

In step S162.1, the compaction unit 370 notifies the log storage unit284 of add completion information of the corresponding block andrequests the log storage unit 284 to commit the notified information. Inorder to decrease a restoration processing time to be described below,backward lookup logical addresses of all pages that are added in a blockuntil add is completed after the block is allocated may be stored, andthe backward lookup logical addresses of the pages that are added in thecorresponding block may be included in the add end log of thecorresponding block. The log storage unit 284 receives the commitmentnotification from the compaction unit 370 and requests the semiconductorstorage medium control unit 203 to store the temporarily stored updateinformation. The semiconductor storage medium control unit 203 recordsthe temporarily stored update information as a log. If the physicaladdress of the semiconductor storage medium 205 where the log isrecorded cannot be previously recognized, the management informationcannot be restored when power is supplied to the data storage device300. For this reason, the physical address of the semiconductor storagemedium 205 where the log is recorded is made to indicate a predeterminedarea of the semiconductor storage medium 205 or an area that can betraced from information recorded in the predetermined area of thesemiconductor storage medium 205.

In step S162.2, the compaction unit 370 investigates whether all of theblocks allocated from the block use information control unit 326 areused. When all of the blocks are used, the process proceeds to stepS162.3. Meanwhile, when all of the blocks are not used, the processproceeds to step S162.5.

In step S162.3, the compaction unit 370 requests the block useinformation control unit 326 to execute an allocating process of anon-used block. If the block use information control unit 326 receivesan allocation request of a non-used block from the compaction unit 370,the block use information control unit 326 suspends a process of thecompaction unit 370, until the allocation request of the non-used blockis fully received from the write instructing unit 350.

In step S162.4, if the block use information control unit 326 fullyreceives an allocation request of a non-used block from both the writeinstructing unit 350 and the compaction unit 370, and the write amountfrom the host device at a corresponding point of time is 1 and the writeamount of the compaction to be processed in the data storage device 300is N (N is an integer equal to or more than 0), the block useinformation control unit 326 allocates one non-used block to the writeinstructing unit 350 and allocates N non-used blocks to the compactionunit 370. The block use information control unit 326 can determine avalue of N from information of the number of used blocks included inblock use information stored by the block use information storage unit228 or information of the number of non-used blocks. If the value of Nis set to be more than the write amount of the compaction to beprocessed in the data storage device 300 and the write amount from thehost device at a corresponding point of time is 1, when a load of thewrite request from the host device is not large, the block useinformation control unit 326 first executes the compaction process anddecreases the amount of a compaction process to be executed in thefuture, thereby improving responsiveness at the time when the load ofthe write request from the host device increases in the future. Theblock use information control unit 326 updates the block userinformation that is stored by the block use information storage unit228, according to the updated contents. The block use informationcontrol unit 326 restarts the suspended process of the compaction unit370. The block use information control unit 326 notifies the log storageunit 284 of block allocation information with respect to the allocated(N+1) blocks. In the order of the allocation information, a block thatis allocated to the compaction unit 370 is temporally prior to a blockthat is allocated to the write instructing unit 350. When plural blocksare allocated to the compaction unit 370, the order of the allocationinformation becomes order of the blocks that are used by the compactionunit 370. For example, the order of the allocation information in thecase where the blocks are allocated as shown in FIGS. 21 to 25 becomesorder of the block A, the block B, the block C, and the block D. Theorder of the allocation information in the case where the blocks areallocated as shown in FIG. 26 becomes order of the block A in the term1, the block B and the block C in the term 2, the block D in the term 3,the block E in the term 4, the block F in the term 5, and the block Gand the block H in the term 6. The block use information control unit326 requests the log storage unit 284 to commit the information notifiedto the log storage unit 284. The log storage unit 284 receives thecommitment notification from the block use information control unit 326and requests the semiconductor storage medium control unit 203 to storethe temporarily stored update information. The semiconductor storagemedium control unit 203 records the temporarily stored updateinformation as a log. If the physical address of the semiconductorstorage medium 205 where the log is recorded cannot be previouslyrecognized, the management information cannot be restored when power issupplied to the data storage device 300. For this reason, the physicaladdress of the semiconductor storage medium 205 where the log isrecorded is made to indicate a predetermined area of the semiconductorstorage medium 205 or an area that can be traced from informationrecorded in the predetermined area of the semiconductor storage medium205.

As described above, in FIG. 29, the log is recorded by the blockallocation event. However, since the block allocation event is at thesame time as the block allocation process in the write process, as shownin step S64 of FIG. 15, the log commitment process cannot be executed atthe end, so the log needs to be committed on demand.

In step S162.5, the compaction unit 370 requests the compactionlog-structured pointer control unit 242 to update the compactionlog-structured pointer to indicate a page of a head of a next blockallocated from the block use information control unit 326 or a page of ahead of a first block of newly allocated blocks. The compactionlog-structured pointer control unit 242 updates the compactionlog-structured pointer stored by the compaction log-structured pointerstorage unit to indicate a designated page of a designated block.

Since a process of step S165 is the same as that of step S65 of FIG. 15,the description will not be repeated.

Next, a sequence of a management information restoring process that isexecuted by the data storage device 300 will be descried with referenceto FIG. 30. FIG. 30 is a flowchart showing an example of a flow of thesequence of the management information restoring process executed by thedata storage device 300. The data storage device 300 restores themanagement information when power is supplied to the data storage device300. The data storage device 300 may restore the management informationat timing when the management information needs to be restored, even inthe cases other than when the power is supplied to the data storagedevice 300. For example, when it is detected that data of the managementinformation stored in the DRAM 54 corrupts, the data storage device 300may execute the management information restoring process.

First, since processes of steps S181 to S184 are almost the same asthose of steps S81 to S84 of FIG. 17, the description will not berepeated. However, kinds of a log of step S183 include free blockcollection information indicating that the block is collected as thenon-used block, block add completion information indicating that add ofthe block is completed, and block allocation information indicatingallocation of the block. A process of step S183 corresponds to theprocess of step S83 of FIG. 17 that updates the management informationrestored according to the log information and shows a process accordingto the kind of each log. In this case, in the information of the newlyallocated block, information of one or more blocks for the compactionadd is arranged in order of the blocks used by the compaction unit 370,and the information of the blocks for the host add used by the writeinstructing unit 350 is arranged. Therefore, the restoring process onthe allocation log of the block is repetitively executed with respect toeach allocated block number.

Hereinafter, the process according to the kind of each log will bedescribed.

First, a sequence of a flow of the restoring process when the kind ofeach log is the block allocation information will be described withreference to FIG. 31. FIG. 31 is a flowchart showing an example of aflow of a sequence of the restoring process when the kind of each log isthe block allocation information.

In step S201, the log restoring unit 394 issues a read request of a pageto the semiconductor storage medium control unit 203, sequentially froma page of a head, with respect to the blocks of the block numbersrecorded in the log. That is, the following processes are repetitivelyexecuted. The semiconductor storage medium control unit 203 reads thedata of the designated physical address of the semiconductor storagemedium 205 and provides the data. The log restoring unit 394 receivesthe data of the read page from the semiconductor storage medium controlunit 203.

In step S202, the log restoring unit 394 determines whether the readpage is the non-recorded page. Specifically, since all bits of the dataof the erased page including the data of the redundant area shown inFIG. 27 have a value of 1, if it is determined whether the values of allof the bits become 1, it can be recognized that the read page is anon-recorded page. When the read page is the non-recorded page, theprocess proceeds to step S203. Meanwhile, when the read page is not thenon-recorded page, that is, the recorded page, the process proceeds tostep S204.

In step S203, the log restoring unit 394 requests the host writelog-structured pointer control unit 232 to update the host writelog-structured pointer to indicate the non-recorded page, when thecorresponding block is the log-structured block for the host write.Likewise, the log restoring unit 394 requests the compactionlog-structured pointer control unit 242 to update the compactionlog-structured pointer, when the corresponding block is the blockallocated for the compaction add. The host write log-structured pointercontrol unit 232 receivers the host write log-structured pointer updaterequest from the log restoring unit 394 and updates the host writelog-structured pointer that is stored by the host write log-structuredpointer storage unit 230. The compaction log-structured pointer controlunit 242 receives the compaction log-structured pointer update requestfrom the log restoring unit 394 and updates the compactionlog-structured pointer that is stored by the compaction log-structuredpointer storage unit 240.

In step S204, the log restoring unit 394 extracts the backward lookuplogical address information from the read data.

In steps S205 to S209, the log restoring unit 394 causes the entry ofthe extracted backward lookup logical address information of theconversion table to indicate the read page, on the basis of theextracted backward lookup logical address information. Specifically, thelog restoring unit 394 inquires the conversion table control unit 221 ofa physical address (pre-update physical address) that corresponds to theextracted backward lookup logical address, before reading the page. Theconversion table control unit 221 refers to the conversion table that isstored by the conversion table storage unit 223 and provides thephysical address (pre-update physical address) that corresponds to theextracted backward lookup logical address, before reading the page. Thelog restoring unit 394 acquires the physical address (pre-updatephysical address) that corresponds to the extracted backward lookuplogical address, before reading the page. The log restoring unit 394requests the conversion table control unit 221 to cause a valid pageflag that the acquired pre-update physical address corresponds to becomeOFF. The log restoring unit 394 requests the conversion table controlunit 221 to decrement a valid page counter of a block that the acquiredpre-update physical address corresponds. The log restoring unit 394requests the conversion table control unit 221 to cause a valid pageflag that the read page corresponds to become ON. The log restoring unit394 requests the conversion table control unit 221 to increment a validpage counter of a block that the read page corresponds. The logrestoring unit 394 requests the conversion table control unit 221 toupdate the extracted backward lookup logical address of the forwardlookup table to indicate the physical address area information that theread page corresponds. The conversion table control unit 221 updates theconversion table that is stored by the conversion table storage unit323, according to the instruction.

As described above, the same process as the update process of theconversion table at the time of the page write is executed. That is, inthe third embodiment, the update information of the managementinformation is not recorded in the log in detail and not restored, andthe factor by which the management information is updated is recorded,an aspect of the management information being updated from the factor isreproduced, and the management information is restored.

In step S210, the process is repeated from step S201, as needed.

In this case, in the same term, even when the host write process and thecompaction process are generated in the same logical address, the changeaccording to the compaction write is first reflected on the managementinformation and the change according to the host write is reflected.Finally, a series of management information shows the page subjected tothe host write. Thereby, consistency of the management information issecured.

Next, a sequence of a flow of the restoring process when the kind ofeach log is the add completion information of the block will bedescribed with reference to FIG. 32. FIG. 32 is a flowchart showing anexample of a flow of a sequence of the restoring process when the kindof each log is the add completion information of the block.

In the log, the information of the newly allocated block, the addcompletion information of the block, and the information indicating thatthe block is collected as the non-used block are recorded. The term doesnot proceed to a next term as long as the add of all of the blocksallocated in the certain term is not completed. In step S220, when thelog is traced in record order, the log restoring unit 394 confirms thata log of block allocation of a next term is recorded in a state whereadd completion information of all of the blocks allocated in the certainterm is recorded, and validity of the log can be investigated. When thebackward lookup logical addresses of all of the pages added in the blockuntil the add is completed after the block is allocated are stored andthe backward lookup logical addresses of the pages added in thecorresponding block are included in the add completion log of thecorresponding block, the backward lookup logical addresses of all of thepages added in the block can be recognized by only viewing the addcompletion log. Thereby, the process of step S201 of FIG. 31, that is,the read process from the semiconductor storage medium 205 can begreatly decreased. For this reason, the pages may be read sequentiallyfrom the head, with respect to only the block where the final add isperformed. As a result, the process time of the management informationrestoring process can be decreased.

Next, a sequence of a flow of the restoring process when the kind ofeach log is the free block collection information will be described withreference to FIG. 33. FIG. 33 is a flowchart showing an example of aflow of a sequence of the restoring process when the kind of each log isthe free block collection information. In step S230, the log restoringunit 394 requests the block use information control unit 326 to changethe use state of the corresponding block to the non-used state. Theblock use information control unit 326 updates the block use informationthat is stored by the block use information storage unit 228, accordingto the request from the log restoring unit 394.

By the above process, the management information can be correctlyrestored while the log record count can be greatly decreased. As aresult, as compared with the write performance of the data with respectto the storage medium, the write performance with respect to the writerequest from the host device can be further improved. Further, thedesign lifespan of the data storage device can be increased.

In the third embodiment, the following two constraints exist in theblock allocation rule.

The first constraint is that the new block allocation of thelog-structured block for the compaction add and the log-structured blockfor the host write is synchronously performed when the host writelog-structured pointer and the compaction log-structured pointer use allof the blocks allocated in the corresponding term.

The second constraint relates to the number of allocated blocks, i.e.,one non-used block is allocated to the block for the host add and Nnon-used blocks are allocated to the block for the compaction add, whenthe write amount from the host device at a corresponding point of timeis 1 and the write amount of the compaction to be processed in the datastorage device is N (N is an integer equal to or more than 0).

Next, an example in which the management information cannot be correctlyrestored because of violating the above constraints will be describedwith reference to FIGS. 34 to 38, while considering the restoration ofthe forward lookup table. Since a situation mentioned below isapplicable to the restoration of the valid page flag or the valid pagecounter, the description will not be repeated herein.

In a situation where the blocks are used for the host write and thecompaction, as shown in FIG. 34, the log-structured pointer for the hostwrite arrives at the end of the block. In this case, the new block isacquired violating the first constraint, and the write access from thehost device is continuously processed as shown in FIG. 35. In this case,since the address deviation is generated in the write access from thehost device, as shown in FIGS. 35 and 36, data of a LBA 2 that isrecorded in the block A for the compaction is invalidated, the block Bbecomes the compaction object, and data of a LBA 4 is copied into theblock A for the compaction. The log at this point of time is shown inFIG. 37.

In the situation shown in FIG. 36, the contents of the forward lookuptable are restored because the supply of power to the data storagedevice 300 is interrupted and the power is supplied again to the datastorage device 300. In this case, as shown in FIG. 37, since temporalorder of a log indicating that “the blocks are prepared” is order of theblock A, the block B, the block C, and the block D, a page of each blockis read in this order and a forward lookup table shown in FIG. 38 isrestored. In the forward lookup table shown in FIG. 38, the informationof the forward lookup table with respect to the LBA 4 may indicate apage 0 of the block B that is not newest.

Next, an example in which the management information can be correctlyrestored because of keeping the above constraints will be described withreference to FIGS. 39 to 44, while considering the restoration of theforward lookup table.

In a situation where the blocks are used for the host write and thecompaction, as shown in FIG. 39, the log-structured pointer for the hostwrite arrives at the end of the block. In this case, the firstconstraint is kept, the acquisition of the new block is delayed untilthe log-structured pointer for the compaction arrives at the end of theblock as shown in FIG. 40, and new blocks are acquired when thelog-structured pointers arrive at the end of the block used for thewrite. Then, the write according to the write request from the hostdevice and the compaction write are continuously processed, and theacquisition of the block is synchronously performed as shown in FIG. 41.As shown in FIG. 42, the block B for the host write is set as thecompaction object and the compaction is performed, and the valid pagethat exists in the block B is copied into the block E. The log at thispoint of time is shown in FIG. 43.

In the situation shown in FIG. 42, the contents of the forward lookuptable are restored because the supply of power to the data storagedevice 300 is interrupted and the power is supplied again to the datastorage device 300. FIG. 44 shows the restored forward lookup table.Since a focused LBA (logical address) is a forth LBA, eleventh toseventeenth LBAs are not shown in FIG. 42. If the constraints are kept,since the block for the host write and the block for the compaction arenecessarily acquired in a form of a group when the log-structuredpointers acquire new blocks, a restoring process is executed in a groupunit, even in the case where the forward lookup table is reconstructed.In the case of a state of FIG. 44, three groups that include a group ofblocks A and B, a group of blocks C and D, and a group of blocks E and Fare obtained. Restoration order of the three groups is order in whichthe blocks are used in a write process. First, pages of the group of theblocks A and B, the pages of the group of the blocks C and D, and thepages of the group of the blocks E and F are sequentially read and theforward lookup tables are restored. In each group, after the pages ofthe block for the compaction are read and the forward lookup table isrestored, the pages of the block for the host write are read and theforward lookup table is restored. For example, with respect to the groupof the blocks A and B, after the pages of the block A are processed, thepages of the block B are processed.

As shown in the forward lookup table restoration result of FIG. 44, itcan be recognized that the restoration result of the forward lookuptable secures consistency, in spite that data written from the hostdevice is immediately compacted, because the address deviation isgenerated as in the access pattern shown in FIG. 36.

The first constraint is a constraint that causes the acquisition of theblocks to write two kinds of data having different characteristics to beperformed when the two write pointers use all of the acquired blocks,and causes the write history with respect to each block to be stored andspecified in correct order. From this configuration, it can berecognized that forward lookup table restoration from the log cannot becorrectly performed, if the first constraint is not kept.

The second constraint is a constraint that causes the change in thewrite request frequency from the host device or the change in the numberof non-used blocks to be dynamically reflected, while keeping the firstconstraint. In the situation where the compaction does not need to beperformed, for example, immediately after the use of the system starts,the blocks may not be acquired by the log-structured pointer for thecompaction. Meanwhile, in a situation where the compaction needs to beperformed due to a decrease in the number of non-used blocks of thesystem, a lot of blocks are made to be acquired by the log-structuredpointer for the compaction, and a situation where the compaction isperformed many times with respect to the host write is generated.

In this way, the write amount of the compaction that is needed at acorresponding point of time can be secured, and the process can beavoided, as much as possible, from being suspended until the otherlog-structured pointer arrives at the end of the allocated block, evenwhen one log-structured pointer arrives at the end of the allocatedblock.

Fourth Embodiment

In the fourth embodiment, an example in which a valid page flag is notincluded in a conversion table will be described.

If the following first and second relationships are realized between thebackward lookup logical address written in the page and the forwardlookup table, the configuration in which the valid page flag is notincluded in the conversion table can be employed.

The first relation is that, “when the forward lookup table is referredby the backward lookup logical address written in the page and thephysical address recorded in the forward lookup table indicates thecorresponding page, this means that write with respect to thecorresponding logical address is not performed after write of thecorresponding page, and the corresponding page is valid”.

The second relation is that, “when the forward lookup table is referredby the backward lookup logical address written in the page and thephysical address recorded in the forward lookup table does not indicatethe corresponding page, this means that write with respect to thecorresponding logical address is performed after write of thecorresponding page, and the corresponding page is invalid”.

When the conversion table is constructed not to include the valid pageflag, using the above relationships, the processes of referring to ONand OFF of the valid page flag described above are replaced by thefollowing processes.

(1) process of reading data of pages.

(2) process of referring to the forward lookup table by the backwardlookup logical address and determining whether the physical addressrecorded in the forward lookup table indicates the page read by (1).

(3) process of determining that the valid page flag is ON when (2)becomes true and determining that the valid page flag is OFF when (2)becomes false.

As described above, in the fourth embodiment, the memory use amount ofthe management information can be decreased by using the configurationwhere the valid page flag is not included in the conversion table. Whenthe memory use amount of the management information can be decreased,this means that the capacity to be stored as the snapshot can bedecreased. As a result, the process time that is needed to store thesnapshot can be decreased, the write amount with respect to thesemiconductor storage medium can be reduced, and the design lifespan ofthe data storage device can be increased. The “backward lookup logicaladdress written in the page” may be read as the “backward lookup logicaladdress corresponding to the corresponding page in the conversiontable”.

Fifth Embodiment

In the fifth embodiment, an example in which various process are notexecuted in a block unit but are executed in a unit called a logicalblock where plural blocks are combined will be described. Hereinafter,the block is called a physical block to distinguish the block and thelogical block from each other.

When the processes are executed in the logical block unit, the forwardlookup table has an LBA table of a first stage shown in FIG. 45 and alogical/physical conversion table of a second stage shown in FIG. 46.The LBA table uses the logical address as an index and includes thelogical address, a logical block number assigned to the logical block, achannel number, and a page number assigned to the page. The logicalblock numbers are assigned in block generation order. The channelnumbers become CH0 to CH5 in the case of the configuration shown in FIG.1 and show the channels where write object data is written. Thelogical/physical conversion table is information that indicates eachphysical block of each channel belonging to the logical block. Thelogical/physical conversion table uses the logical block number as anindex and includes a logical block number and each physical block numberfor each channel included in the logical block.

The backward lookup table, the valid page flag, and the valid pagecounter are shown in FIG. 47. As shown in FIG. 47, the backward lookuptable, the valid page flag, and the valid page counter use the logicalblock number as an index, and include the logical block number, thevalid page counter, the logical address of each physical block of eachchannel, and the valid page flag set as an entry. The logical address ofeach physical block of each channel and the valid page flag set use thechannel number as an index, and the channel number, the logical address,and the valid page flag are arranged in order of pages disposed in thecorresponding physical block and the page that the logical addressinformation or the valid page flag information correspond can bespecified. A value of the valid page counter of the same logical blockand the total number of true values of the valid page flags are matchedwith each other. The logical block number that becomes the index and thelogical block number that becomes the entry of the forward lookup tableare assigned with the same number in the same block.

Similar to the backward lookup table shown in FIG. 9, the backwardlookup table is a table that indicates a correspondence relationship ofa logical address of data stored by the data storage device and aphysical address indicating a physical storage position where data isactually stored in the semiconductor storage medium, and is used whenthe address is converted from the physical address to the logicaladdress, in contrast to the forward lookup table. The valid page flagshows a valid page where valid data is written among the pages includedin the physical block, using a true/false value. The valid page countershows the number of valid pages among the pages included in the logicalblock.

In this case, if write order of the pages of the physical blockconstituting the logical block, that is, an advancing method of thelog-structured pointer is determined as shown in FIG. 48, the variousprocesses in the (physical) block unit described above can be replacedby the processes in the logical block unit. Thereby, the pluralsemiconductor storage media are collectively accessed and the accessspeed can be increased. By combining the third embodiment or the fourthembodiment, the configuration where the backward lookup table or thevalid page flag is not included may be used.

While certain embodiments have been described, these embodiments havebeen presented by way of example only, and are not intended to limit thescope of the inventions. Indeed, the novel embodiments described hereinmay be embodied in a variety of other forms; furthermore, variousomissions, substitutions and changes in the form of the embodimentsdescribed herein may be made without departing from the spirit of theinventions. The accompanying claims and their equivalents are intendedto cover such forms or modifications as would fall within the scope andspirit of the inventions.

1-8. (canceled) 9: A memory system comprising: a nonvolatilesemiconductor memory comprising a plurality of blocks, the blocksincluding one or more first blocks, a plurality of second blocks whichdiffer from the first blocks, and a third block, each of the blocksbeing a unit of an erase operation of the nonvolatile semiconductormemory; and a controller circuit configured to receive a write requestfrom a host device, the write request including a size of first data tobe written to the memory system; wherein the controller circuit isconfigured to perform a write operation of the first data to the firstblocks in response to the write request; the controller circuit isconfigured to perform a compaction operation of reallocating second datastored in the second blocks to the third block which stores no validdata and treating the second blocks as free blocks; the controllercircuit is configured to switch, while continuously performing one ofthe compaction operation and the write operation, the operation to theother of the compaction operation and the write operation. 10: Thecontroller of claim 9, wherein the controller circuit switches theoperation to the write operation, when receiving the write request fromthe host device while continuously performing the compaction operation.11: The controller of claim 10, wherein the controller circuit restartsthe compaction operation, upon completing the write operation after theswitching. 12: The controller of claim 9, wherein the controller circuitswitches between the compaction operation and the write operation inunit of a page. 13: The controller of claim 9, wherein the controllercircuit starts the compaction operation when a number of non-used blocksis less than a predetermined threshold value. 14: The memory system ofclaim 9, wherein the controller circuit starts the compaction operationbefore receiving the write request from the host device. 15: Anon-transitory computer readable medium including programmedinstructions for a controller circuit of a memory system, the memorysystem comprising a nonvolatile semiconductor memory comprising aplurality of blocks, the blocks including one or more first blocks, aplurality of second blocks which differ from the first blocks, and athird block, each of the blocks being a unit of an erase operation ofthe nonvolatile semiconductor memory; the programmed instructionscausing the controller circuit to perform: receiving a write requestfrom a host device, the write request including a size of first data tobe written to the memory system, performing a write operation of thefirst data to the first blocks in response to the write request;performing a compaction operation of reallocating second data stored inthe second blocks to the third block which stores no valid data andtreating the second blocks as free blocks; switching, while continuouslyperforming one of the compaction operation and the write operation, theoperation to the other of the compaction operation and the writeoperation. 16: A method that is used for a controller circuit of amemory system, the memory system comprising a nonvolatile semiconductormemory comprising a plurality of blocks, the blocks including one ormore first blocks, a plurality of second blocks which differ from thefirst blocks, and a third block, each of the blocks being a unit of anerase operation of the nonvolatile semiconductor memory; the methodcomprising: receiving a write request from a host device, the writerequest including a size of first data to be written to the memorysystem, performing a write operation of the first data to the firstblocks in response to the write request; performing a compactionoperation of reallocating second data stored in the second blocks to thethird block which stores no valid data and treating the second blocks asfree blocks; switching, while continuously performing one of thecompaction operation and the write operation, the operation to the otherof the compaction operation and the write operation.